/* Validators hub — shared styles for every page.

   Built on tokens.css (the Marinade Design System, ported from marinade-web):
   colours, type, radius, shadow and motion all come from tokens, and the
   component rules below mirror marinade-web's primitives — Card, Badge, Button,
   Tabs, Table, Input, Tooltip, InlineAlert. Class names are the hub's own (the
   HTML/JS markup did not change); each block notes which primitive it follows.

   All styling lives in files (no inline styles, no runtime), so the strict
   marinade-stats CSP (default-src 'none'; style-src 'self'; font-src 'self')
   holds. Geist is self-hosted (variable weight). */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("geist-latin.woff2") format("woff2");
}

html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--color-surface-secondary);
  color: var(--fg);
  font: var(--type-body-md);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--color-base-primary); outline-offset: 2px; }
/* The `hidden` attribute must always win: component rules like `.panel { display: flex }`
   otherwise override the UA `[hidden] { display: none }` (equal specificity, author origin),
   leaving hidden panels (e.g. the validator not-found box, the simulator loading status)
   visible. */
[hidden] { display: none !important; }

/* Theme-specific elements (logo variant, toggle icon). */
.show-dark { display: var(--show-dark) !important; }
.show-light { display: var(--show-light) !important; }

.wrap { max-width: 1160px; margin: 0 auto; }
/* Small accent label above a section title. */
.eyebrow { font: var(--type-label-sm); color: var(--color-text-accent); }
.eyebrow.muted { color: var(--fg-muted); }

.section-title {
  margin: 0;
  font: var(--type-display-2);
  letter-spacing: var(--type-display-2-tracking);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
}

/* ---------------- Header ----------------
   .topbar is the full-width sticky band (card surface + bottom rule) that
   separates the nav from page content; .site-header inside it keeps the
   1160px content width. */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--color-base-card);
  border-bottom: 1px solid var(--color-base-border);
  box-shadow: var(--shadow-xs);
}
.site-header {
  padding: 14px 32px;
  display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--fg);
  font: var(--type-label-lg);
}
.brand:hover { color: var(--fg); }
.brand-logo { height: 26px; width: auto; }
.brand-sub { color: var(--fg-muted); font: var(--type-body-lg); }
/* "Beta" — Badge (accent, sm) raised like a superscript. */
.brand-beta {
  align-self: flex-start; margin-left: -4px; margin-top: -6px;
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--color-fill-accent-subtle); color: var(--color-text-accent-strong);
  font: var(--type-label-sm); white-space: nowrap;
}

/* Lucide icons: inline SVG, stroke = currentColor. */
.icon { display: inline-block; flex: none; }
.card-icon { width: 28px; height: 28px; color: var(--color-text-accent); }
.card-icon.warn { color: var(--color-text-caution); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; font: var(--type-label-md); }
.nav-link {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px;
  border-radius: var(--radius-12);
  color: var(--fg-muted); text-decoration: none;
  transition: color var(--transition-duration-interaction), background-color var(--transition-duration-interaction);
}
.nav-link:hover { color: var(--fg); background: var(--color-base-accent); }
.nav-link.is-active { color: var(--color-text-accent-strong); background: var(--color-fill-accent-subtle); }

/* Theme toggle — Button (ghost, icon, sm). */
.theme-toggle {
  width: 32px; height: 32px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-12);
  background: transparent; color: var(--fg-muted); cursor: pointer;
  transition: background-color var(--transition-duration-interaction), color var(--transition-duration-interaction);
}
.theme-toggle:hover { background: var(--color-base-accent); color: var(--fg); }

/* ---------------- Buttons (marinade-web Button) ----------------
   Base: rounded-12, button type, interaction timing, press = scale .95.
   Variants: primary (filled mint) · outline · ghost · link.
   Sizes: default 36px · sm 32px · xs 24px · lg 48px. */
.btn, .btn-primary, .btn-cta, .toggle, .copybtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-sizing: border-box; white-space: nowrap; cursor: pointer; text-decoration: none;
  border-radius: var(--radius-12); font: var(--type-button-md); font-variant-numeric: tabular-nums;
  transition-property: background-color, border-color, color, box-shadow, scale, opacity;
  transition-duration: var(--transition-duration-interaction);
}
.btn:active, .btn-primary:active, .btn-cta:active, .toggle:active, .copybtn:active { scale: 0.95; opacity: 0.6; }
.btn:focus-visible, .btn-primary:focus-visible, .btn-cta:focus-visible, .toggle:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--color-base-primary-opacity);
}

/* primary */
.btn-primary, .btn-cta, .btn.primary {
  border: 0; background: var(--color-base-primary); color: var(--color-base-primary-foreground);
  box-shadow: var(--shadow-button);
}
.btn-primary:hover, .btn-cta:hover, .btn.primary:hover {
  background: var(--color-base-primary-hover); color: var(--color-base-primary-foreground);
  box-shadow: var(--shadow-button-hover);
}
/* outline */
.btn.secondary, .btn-cta.btn-ghost, .toggle, .copybtn {
  border: 1px solid var(--color-base-border); background: var(--color-base-background);
  color: var(--color-base-foreground); box-shadow: var(--shadow-button);
}
.btn.secondary:hover, .btn-cta.btn-ghost:hover, .toggle:hover, .copybtn:hover {
  border-color: var(--color-base-border-hover); color: var(--color-base-foreground);
  box-shadow: var(--shadow-button-hover);
}
/* sizes */
.btn, .toggle { height: 36px; padding: 0 16px; }
.btn-primary, .btn-cta { height: 48px; padding: 0 20px; font: var(--type-button-lg); }
.copybtn { height: 24px; padding: 0 8px; border-radius: var(--radius-8); font: var(--type-button-sm); }

/* Toggle filters ("Only bidding", "Only active stake") — outline at rest,
   selected fill when on (FilteringBadge / fill-selected). */
.toggle.is-on, .toggle.is-on:hover {
  background: var(--color-fill-selected); border-color: var(--color-fill-selected); color: var(--on-selected);
}

/* ---------------- Hero (home) ---------------- */
.hero {
  padding: 48px 32px 80px;
  display: flex; flex-wrap: wrap; gap: 48px; align-items: center;
}
.hero-copy {
  flex: 1 1 440px; min-width: 0;
  display: flex; flex-direction: column; gap: 24px;
}
.hero-title { margin: 0; font: var(--type-display-1); letter-spacing: var(--type-display-1-tracking); }
.hero-lede { margin: 0; font: var(--type-body-lg); color: var(--fg-muted); max-width: 520px; }
.bid-form { display: flex; flex-wrap: wrap; gap: 12px; max-width: 540px; }
.form-note { font: var(--type-body-sm); color: var(--fg-muted); }

/* ---------------- Inputs (marinade-web Input) ----------------
   rounded-12, base-input border on the card surface, ring on focus. */
.bid-input, .field {
  box-sizing: border-box; min-width: 0;
  border: 1px solid var(--color-base-input); border-radius: var(--radius-12);
  background: var(--color-base-card); color: var(--fg);
  transition: border-color var(--transition-duration-interaction), box-shadow var(--transition-duration-interaction);
}
.bid-input { flex: 1 1 280px; height: 48px; padding: 0 16px; font: var(--type-body-lg); }
.field { height: 36px; padding: 0 12px; min-width: 240px; font: var(--type-body-md); }
.bid-input::placeholder, .field::placeholder { color: var(--color-base-muted-foreground); }
.bid-input:focus, .field:focus {
  outline: none; border-color: var(--color-base-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-base-ring) 50%, transparent);
}

/* ---------------- Cards (marinade-web Card) ----------------
   Top-level: rounded-24, card surface, base border. Nested: rounded-12. */
.chart-card, .card, .cta-card, .tile, .panel {
  box-sizing: border-box;
  background: var(--color-base-card); border: 1px solid var(--color-base-border);
  border-radius: var(--radius-24);
}

/* Home chart card */
.chart-card {
  flex: 1 1 460px; min-width: 0; margin: 0; padding: 24px;
  display: flex; flex-direction: column; gap: 20px;
}
.chart-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap;
}
.chart-head-label { font: var(--type-label-md); color: var(--fg-muted); }
.chart-head-note { font: var(--type-body-sm); color: var(--fg-muted); }
.chart-stat { display: flex; align-items: baseline; gap: 12px; }
.chart-stat-num {
  font: var(--type-number-4xl); letter-spacing: var(--type-number-4xl-tracking);
  font-variant-numeric: tabular-nums; color: var(--color-text-accent);
}
.chart-stat-cap { font: var(--type-body-lg); color: var(--fg-muted); }

.chart {
  position: relative; height: 220px;
  display: flex; align-items: flex-end; gap: 4px;
  border-bottom: 1px solid var(--chart-grid);
}
.bar { flex: 1 1 0; min-width: 0; border-radius: var(--radius-2) var(--radius-2) 0 0; }
.bar.is-won { background: var(--chart-accent); }
.bar.is-skipped { background: var(--chart-muted); }
/* Heights: price / 0.032 * 220px, rounded (see the source mockup's renderVals). */
.bar:nth-child(1)  { height: 129px; }
.bar:nth-child(2)  { height: 137px; }
.bar:nth-child(3)  { height: 142px; }
.bar:nth-child(4)  { height: 143px; }
.bar:nth-child(5)  { height: 109px; }
.bar:nth-child(6)  { height: 109px; }
.bar:nth-child(7)  { height: 109px; }
.bar:nth-child(8)  { height: 109px; }
.bar:nth-child(9)  { height: 37px; }
.bar:nth-child(10) { height: 41px; }
.bar:nth-child(11) { height: 135px; }
.bar:nth-child(12) { height: 135px; }
.bar:nth-child(13) { height: 76px; }
.bar:nth-child(14) { height: 58px; }
.bar:nth-child(15) { height: 62px; }
.bar:nth-child(16) { height: 109px; }
.bar:nth-child(17) { height: 109px; }
.bar:nth-child(18) { height: 109px; }
.bar:nth-child(19) { height: 55px; }
.bar:nth-child(20) { height: 118px; }
.bar:nth-child(21) { height: 172px; }
.bar:nth-child(22) { height: 177px; }
.bar:nth-child(23) { height: 182px; }
.bar:nth-child(24) { height: 177px; }
.bar:nth-child(25) { height: 165px; }
.bar:nth-child(26) { height: 175px; }
.bar:nth-child(27) { height: 171px; }
.bar:nth-child(28) { height: 199px; }
.bar:nth-child(29) { height: 183px; }
.bar:nth-child(30) { height: 175px; }
.bid-line {
  position: absolute; left: 0; right: 0; bottom: 135px;
  border-top: 2px dashed var(--chart-ink);
}
.bid-label {
  position: absolute; right: 0; bottom: 141px;
  font: var(--type-label-sm); font-variant-numeric: tabular-nums; color: var(--fg);
  background: var(--color-base-card); padding: 2px 6px; border-radius: var(--radius-4);
}
.legend { display: flex; flex-wrap: wrap; gap: 20px; font: var(--type-body-sm); color: var(--fg-muted); }
.legend-item { display: flex; align-items: center; gap: 8px; }
.swatch { width: 12px; height: 12px; border-radius: var(--radius-2); }
.swatch-won { background: var(--chart-accent); }
.swatch-skip { background: var(--chart-muted); }

/* ---------------- Home sections ---------------- */
.downside {
  border-top: 1px solid var(--color-base-border); border-bottom: 1px solid var(--color-base-border);
  background: var(--color-base-muted);
}
.section-inner { padding: 80px 32px; display: flex; flex-direction: column; gap: 40px; }
.section-head { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px;
}
.card { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.card-title { margin: 0; font: var(--type-heading-3); }
.card-text { margin: 0; font: var(--type-body-lg); color: var(--fg-muted); }

/* Hub product cards (clickable) — EntryCard: resting shadow + accent CTA button
   so they read as links before hover; hover adds border + lift + card-hover shadow. */
.hub-cards { margin: 8px 0 12px; }
.card-link {
  color: inherit; text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition-property: border-color, translate, box-shadow;
  transition-duration: var(--transition-duration-interaction);
  transition-timing-function: var(--ease-card);
}
.card-link:hover {
  color: inherit; border-color: var(--color-border-accent);
  translate: 0 -2px; box-shadow: var(--shadow-card-hover);
}
.card-cta {
  margin-top: auto; align-self: flex-start;
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px;
  border-radius: var(--radius-12);
  background: var(--color-fill-accent-subtle); color: var(--color-text-accent-strong);
  font: var(--type-button-md); text-decoration: none;
  transition: background-color var(--transition-duration-interaction), color var(--transition-duration-interaction);
}
.card-link:hover .card-cta { background: var(--color-base-primary); color: var(--color-base-primary-foreground); }

/* Steps */
.steps { padding: 80px 32px; display: flex; flex-direction: column; gap: 40px; }
.steps-list {
  margin: 0; padding: 0; list-style: none;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px;
}
.step {
  display: flex; flex-direction: column; gap: 8px;
  border-top: 2px solid var(--color-base-border); padding-top: 20px;
}
.step.is-active { border-top-color: var(--color-base-primary); }
.step-num { font: var(--type-label-md); font-variant-numeric: tabular-nums; color: var(--fg-muted); }
.step.is-active .step-num { color: var(--color-text-accent); }
.step-title { font: var(--type-heading-4); }
.step-text { font: var(--type-body-lg); color: var(--fg-muted); }

/* CTA */
.cta { padding: 0 32px 96px; }
.cta-card {
  padding: 48px; display: flex; flex-wrap: wrap; gap: 24px;
  align-items: center; justify-content: space-between;
}
.cta-copy { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cta-title { margin: 0; font: var(--type-heading-1); letter-spacing: var(--type-heading-1-tracking); }
.cta-text { margin: 0; font: var(--type-body-lg); color: var(--fg-muted); }

/* ------------------------------------------------------------------ *
   Dashboards (SAM, Select, Settlements, validator pages).
 * ------------------------------------------------------------------ */

/* Section tabs under the header — Tabs (line variant): label type, muted
   triggers, a 2px primary indicator under the active one. */
.subnav {
  display: flex; gap: 24px; flex-wrap: wrap;
  padding: 0 32px; border-bottom: 1px solid var(--color-base-border);
  font: var(--type-label-md);
}
.subnav-link {
  display: inline-flex; align-items: center; height: 44px; box-sizing: border-box;
  color: var(--fg-muted); text-decoration: none;
  margin-bottom: -1px; border-bottom: 2px solid transparent;
  transition: color var(--transition-duration-interaction), border-color var(--transition-duration-interaction);
}
.subnav-link:hover { color: var(--fg); }
.subnav-link.is-active { color: var(--fg); border-bottom-color: var(--color-base-primary); }

.dash { padding: 32px 32px 72px; display: flex; flex-direction: column; gap: 24px; }
.dash-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.dash-title { margin: 0 0 8px; font: var(--type-display-2); letter-spacing: var(--type-display-2-tracking); }
.dash-lede { margin: 0; font: var(--type-body-lg); color: var(--fg-muted); max-width: 720px; }
.dash-head.is-center { justify-content: center; text-align: center; }
.dash-head.is-center .dash-lede { margin: 0 auto; }
.status { font: var(--type-body-sm); color: var(--fg-subtle); white-space: nowrap; }

/* Stat tiles — Card with a label / number-2xl value / caption. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tile { padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.tile-warn { border-color: var(--color-base-warning); }
.tile-label { font: var(--type-label-sm); color: var(--fg-muted); }
.tile-value {
  font: var(--type-number-2xl); letter-spacing: var(--type-number-2xl-tracking);
  font-variant-numeric: tabular-nums;
}
.tile-warn .tile-value { color: var(--color-base-warning-foreground); }
.tile-sub { font: var(--type-body-sm); color: var(--fg-muted); }

/* Panels — Card, lg padding. */
.panel { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.panel-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.panel-title { margin: 0 0 4px; font: var(--type-heading-3); }
.panel-desc { margin: 0; font: var(--type-body-md); color: var(--fg-muted); max-width: 640px; }
.panel-prose { gap: 12px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Filter chips — FilteringBadge (sm): rounded-8, button-sm, outline at rest. */
.chips { display: flex; flex-direction: column; gap: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-label { font: var(--type-label-sm); color: var(--fg-muted); margin-right: 4px; min-width: 60px; }
.chip {
  height: 28px; padding: 0 10px; box-sizing: border-box;
  border-radius: var(--radius-8); border: 1px solid var(--color-base-border);
  background: var(--color-base-background); color: var(--color-base-foreground);
  font: var(--type-button-sm); font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background-color var(--transition-duration-interaction), border-color var(--transition-duration-interaction);
}
.chip:hover { border-color: var(--color-base-border-hover); }
.chip.is-on, .chip.is-on:hover { background: var(--color-fill-selected); border-color: var(--color-fill-selected); color: var(--on-selected); }

/* Tables — Table: body-md rows, label-sm muted header, base-border row rules,
   muted row hover. Edge cells line up with the panel padding. */
.table-wrap { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font: var(--type-body-md); }
.dtable th, .dtable td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--color-base-border); vertical-align: top;
}
.dtable th:first-child, .dtable td:first-child { padding-left: 0; }
.dtable th:last-child, .dtable td:last-child { padding-right: 0; }
.dtable thead th {
  height: 40px; box-sizing: border-box; vertical-align: middle;
  color: var(--color-base-muted-foreground); font: var(--type-label-sm); white-space: nowrap;
}
.dtable th.sortable { cursor: pointer; user-select: none; }
.dtable th.sortable:hover { color: var(--fg); }
.dtable tbody tr { transition: background-color var(--transition-duration-interaction); }
.dtable tbody tr:hover { background: color-mix(in srgb, var(--color-base-muted) 50%, transparent); }
.dtable tbody tr.row-link { cursor: pointer; }
/* chain epoch vs auction-run epoch line on the SAM pages */
.epochline { margin: -12px 0 0; font: var(--type-body-sm); color: var(--fg-subtle); }
.epochline.is-behind { color: var(--color-base-warning-foreground); }

/* signed stake change (target - active) */
.chg { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg-up { color: var(--color-text-positive); }
.chg-down { color: var(--color-text-negative); }
.chg-zero { color: var(--fg-subtle); }
.dtable tbody tr.row-link:hover .vcell-name { color: var(--color-text-accent); }
.ta-right { text-align: right; font-variant-numeric: tabular-nums; }
.caret { color: var(--color-text-accent); }

/* Validator cell — avatar placeholder + name over the vote account. */
.vcell { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.vcell:hover { color: var(--fg); }
.vcell:hover .vcell-name { color: var(--color-text-accent); }
.avatar {
  width: 28px; height: 28px; flex: none; border-radius: var(--radius-pill);
  background: var(--color-fill-tertiary); color: var(--color-text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  font: var(--type-label-sm);
}
.vcell-text { display: flex; flex-direction: column; min-width: 0; }
.vcell-name { font: var(--type-label-md); transition: color var(--transition-duration-interaction); }
.vcell-vote {
  font: var(--type-body-sm); color: var(--fg-subtle);
  max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Badges — Badge: pill, label-sm, 20px, borderless tinted fill per tone. */
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; box-sizing: border-box;
  border-radius: var(--radius-pill); border: 1px solid transparent;
  font: var(--type-label-sm); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.badge-neutral { background: var(--color-fill-tertiary); color: var(--color-text-secondary); }
.badge-accent { background: var(--color-fill-accent-subtle); color: var(--color-text-accent-strong); }
.badge-positive { background: var(--color-fill-positive); color: var(--color-text-positive-strong); }
.badge-warning { background: var(--color-fill-caution); color: var(--color-text-caution-strong); }
.badge-info { background: var(--color-fill-info); color: var(--color-text-info-strong); }
.badge-negative { background: var(--color-fill-negative); color: var(--color-text-negative-strong); }

/* reason cell */
.reason { display: flex; flex-direction: column; gap: 4px; max-width: 420px; }
.reason-head { display: flex; flex-wrap: wrap; gap: 6px; }
.reason-detail { font: var(--type-body-sm); color: var(--fg-muted); }
.reason-breakdown { font: var(--type-body-sm); font-variant-numeric: tabular-nums; color: var(--fg-subtle); }

/* reason legend */
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 24px; }
.legend-group { display: flex; flex-direction: column; gap: 8px; }
.legend-fam { margin: 0; font: var(--type-heading-5); }
.legend-note { margin: 0 0 4px; font: var(--type-body-sm); color: var(--fg-muted); }
.legend-group .legend-item { flex-direction: column; gap: 6px; align-items: flex-start; margin-bottom: 8px; }
.legend-exp { font: var(--type-body-sm); color: var(--fg-muted); }

@media (max-width: 560px) {
  .site-header { padding: 12px 16px; }
  .dash { padding: 24px 16px 56px; }
  .subnav { padding: 0 16px; gap: 16px; }
  .panel { padding: 16px; }
  .hero, .section-inner, .steps { padding-left: 16px; padding-right: 16px; }
  .cta { padding: 0 16px 64px; }
  .cta-card { padding: 24px; }
}
