/* Meridian — design system.
 *
 * One warm signal colour on a cold near-black ground, hairline rules, mono
 * numerals for anything that is a measurement. Display type is Space Grotesk
 * set tight and uppercase; body is Inter; every figure is JetBrains Mono so
 * columns of numbers line up on the decimal without tabular-nums hacks.
 *
 * All three faces are SIL OFL and served from ./fonts — no external requests.
 */

@font-face { font-family: 'Meridian Display'; src: url('./fonts/space-grotesk-latin.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Meridian Text'; src: url('./fonts/inter-latin.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Meridian Mono'; src: url('./fonts/jetbrains-mono-latin.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --bg:        #07080b;
  --bg-raise:  #0c0e13;
  --panel:     #101319;
  --panel-2:   #141821;
  --line:      #1e232e;
  --line-soft: #171b24;
  --ink:       #e9eef7;
  --ink-dim:   #8a94a6;
  --ink-faint: #59616f;

  /* Signal: warm amber. Distinct from Robinhood green and from the blue that
     every other chain dashboard reaches for. */
  --signal:    #f2a33c;
  --signal-dk: #b8741f;
  --signal-glow: rgba(242, 163, 60, 0.16);

  --settled:   #2ea043;
  --calm:      #7ee787;
  --watch:     #e3b341;
  --stressed:  #f0883e;
  --capitul:   #f85149;

  --up:        #3fb950;
  --down:      #f85149;

  --radius: 3px;
  --cut: 14px;              /* the cut-corner size */
  --maxw: 1240px;
  --font-d: 'Meridian Display', system-ui, sans-serif;
  --font-t: 'Meridian Text', system-ui, sans-serif;
  --font-m: 'Meridian Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-t);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* A faint instrument grid behind everything. Cheap, and it makes the page read
   as a measuring surface rather than a document. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 75%);
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--signal); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* ---- type ---------------------------------------------------------------- */

h1, h2, h3, .display {
  font-family: var(--font-d);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.98;
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); text-transform: uppercase; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); text-transform: uppercase; }
h3 { font-size: 1.05rem; letter-spacing: -0.01em; }

.eyebrow {
  font-family: var(--font-m);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.mono { font-family: var(--font-m); font-variant-numeric: tabular-nums; }
.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }

.num { font-family: var(--font-m); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.up   { color: var(--up); }
.down { color: var(--down); }

/* ---- cut-corner panel ---------------------------------------------------- */
/* The cut lives on the element itself; anything that needs to overflow (menus,
   tooltips) must hang off <body> instead — a clip-path would eat it. */

.cut {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
.cut::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, var(--signal-glow), transparent 42%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.cut:hover::after { opacity: 1; }

.card { padding: 20px 22px; }

/* ---- masthead ------------------------------------------------------------ */

header.top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 8, 11, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-d);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.brand:hover { color: var(--ink); }
.brand svg { display: block; }
nav.top-nav { display: flex; gap: 25px; font-size: 0.83rem; letter-spacing: 0.02em; }
nav.top-nav a { color: var(--ink-dim); transition: color 0.18s; }
nav.top-nav a:hover, nav.top-nav a[aria-current] { color: var(--ink); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.live-dot {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-m); font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint);
}
.live-dot i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--up); box-shadow: 0 0 0 0 rgba(63,185,80,0.6);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(63,185,80,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(63,185,80,0); }
  100% { box-shadow: 0 0 0 0 rgba(63,185,80,0); }
}

/* ---- ticker -------------------------------------------------------------- */
/* A continuous readout of every feed this site prices — the whole board in one
   line, so the market is legible before a single scroll. */

.ticker {
  border-bottom: 1px solid var(--line);
  background: var(--bg-raise);
  overflow: hidden;
  position: relative;
}
.ticker-track {
  display: flex;
  gap: 0;
  width: max-content;
  animation: slide 240s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }

.tick {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 9px 18px;
  border-right: 1px solid var(--line-soft);
  font-family: var(--font-m);
  font-size: 0.76rem;
  white-space: nowrap;
}
.tick b { font-weight: 700; letter-spacing: 0.04em; }
.tick .stress-num { color: var(--ink-dim); }

/* ---- sections --------------------------------------------------------------
 * Three spacing tiers instead of one. A page where every section is 76px apart
 * reads as a conveyor belt — nothing tells you where you are. Generous tiers
 * separate movements, tight ones bind a heading to the block it belongs to. */

section { padding: 72px 0; position: relative; }
section.tight { padding: 40px 0; }
section.lead { padding: 78px 0 30px; }
section.bind { padding: 26px 0 72px; }        /* continues the section above it */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.sec-head p { margin: 8px 0 0; color: var(--ink-dim); max-width: 58ch; font-size: 0.92rem; }
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* A mid tier between the 74px display and the 15px body. Without it every jump
 * in emphasis is either a whisper or a shout. */
.mid { font-family: var(--font-d); font-weight: 700; font-size: clamp(1.35rem, 2.2vw, 1.7rem);
       letter-spacing: -0.025em; line-height: 1.1; }
.figure { font-family: var(--font-d); font-weight: 700; font-size: 2rem; letter-spacing: -0.03em; line-height: 1; }

/* ---- hero ---------------------------------------------------------------- */

.hero { padding: 74px 0 40px; }
.hero h1 { max-width: 16ch; }
.hero h1 em { font-style: normal; color: var(--signal); }
.hero .lede { margin: 22px 0 0; max-width: 60ch; color: var(--ink-dim); font-size: 1.03rem; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  margin-top: 44px;
  background: var(--line);
  border: 1px solid var(--line);
}
.stat { background: var(--bg-raise); padding: 17px 19px; }
.stat .k { font-family: var(--font-m); font-size: 0.65rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }
.stat .v { font-family: var(--font-d); font-weight: 700; font-size: 1.5rem; margin-top: 5px; letter-spacing: -0.02em; }
.stat .s { font-family: var(--font-m); font-size: 0.7rem; color: var(--ink-dim); margin-top: 2px; }

/* ---- hero field ---------------------------------------------------------- */
/* Not an illustration: a canvas the page draws from its own snapshot, one trace
   per feed. See web/assets/hero.js. */

.field {
  margin-top: 44px;
  position: relative;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(242,163,60,0.045), transparent 60%);
}
.field canvas { display: block; width: 100%; height: clamp(240px, 32vw, 400px); }
.field-cap {
  /* Was absolutely positioned under the canvas; now that the field is a real
     chart with axis labels, a normal block keeps it clear of them. */
  display: block;
  margin: 0;
  padding: 11px 0 13px;
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* ---- table ----------------------------------------------------------------
 * Density is the point: this is a terminal, not a report. Rows are ~44px rather
 * than ~76px, the name rides on the same line as the symbol instead of under it,
 * and columns are gathered into families with a hairline between them so the eye
 * can scan "the price block" or "the volatility block" instead of 8 loose columns. */

.table-scroll { overflow-x: auto; border: 1px solid var(--line); background: var(--panel); position: relative; }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.845rem; }
table.grid th {
  font-family: var(--font-m);
  font-size: 0.615rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: right;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--bg-raise);
  position: sticky; top: 0; z-index: 2;
}
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--ink); }
table.grid th[aria-sort] { color: var(--signal); }
table.grid th[aria-sort]::after { content: ' ▾'; font-size: 0.7em; }
table.grid th[aria-sort="ascending"]::after { content: ' ▴'; }

table.grid td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  font-family: var(--font-m);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.5;
}
table.grid tbody tr { transition: background 0.14s; position: relative; }
table.grid tbody tr:hover { background: var(--panel-2); }
table.grid tbody tr:hover td { border-bottom-color: var(--line); }
table.grid td.sym { font-family: var(--font-t); font-weight: 600; letter-spacing: 0.01em; }
table.grid td.sym a { display: flex; align-items: baseline; gap: 9px; }
table.grid td.sym b { font-weight: 600; flex-shrink: 0; }
table.grid td.sym span { font-weight: 400; font-size: 0.775rem; color: var(--ink-faint);
                         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 20ch; }

/* Family separator between column groups. */
table.grid th.grp, table.grid td.grp { border-left: 1px solid var(--line); }

/* The band as a left rule, so a scroll down the board shows the distribution
   without reading a single number. */
table.grid tbody tr td.sym { position: relative; }
table.grid tbody tr td.sym::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px;
  background: var(--band, transparent);
}

/* ---- sparkline ----------------------------------------------------------- */

.spark { display: block; width: 66px; height: 20px; overflow: visible; }
.spark path.line { fill: none; stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round; }
.spark path.fill { stroke: none; opacity: 0.16; }
.spark path.hi { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 2; opacity: 0.55; }

/* ---- sector chip --------------------------------------------------------- */

.sector {
  display: inline-block; font-family: var(--font-m); font-size: 0.63rem;
  letter-spacing: 0.06em; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 2px; padding: 1px 6px; white-space: nowrap;
}
.sector:hover { color: var(--ink-dim); border-color: var(--ink-faint); }

/* ---- movers -------------------------------------------------------------- */

/* Six tiles. `auto-fit` gave five columns at this width and orphaned the sixth
   on its own row, so the count is explicit: 3×2, then 2×3, then 1×6. */
.movers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (max-width: 1000px) { .movers { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .movers { grid-template-columns: 1fr; } }
.mover { background: var(--bg-raise); padding: 15px 17px; display: block; }
.mover:hover { background: var(--panel-2); }
.mover .k { font-family: var(--font-m); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.mover .v { font-family: var(--font-d); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.025em; margin-top: 4px; }
.mover .s { font-family: var(--font-m); font-size: 0.73rem; color: var(--ink-dim); margin-top: 2px; }

.pairs { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.pair { background: var(--bg-raise); display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: baseline; padding: 11px 16px; }
.pair .who { font-family: var(--font-m); font-size: 0.82rem; }
.pair .who b { font-weight: 500; }
.pair .r { font-family: var(--font-m); font-size: 0.82rem; }

/* ---- band chip ----------------------------------------------------------- */

.band {
  display: inline-block;
  font-family: var(--font-m);
  font-size: 0.63rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: 0.95;
}
.band[data-b="settled"]     { color: var(--settled); }
.band[data-b="calm"]        { color: var(--calm); }
.band[data-b="watch"]       { color: var(--watch); }
.band[data-b="stressed"]    { color: var(--stressed); }
.band[data-b="capitulation"]{ color: var(--capitul); }

/* ---- stress meter -------------------------------------------------------- */

.meter { display: inline-flex; align-items: center; gap: 9px; }
.meter-bar {
  width: 74px; height: 4px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.meter-bar i { position: absolute; inset: 0 auto 0 0; display: block; }

/* ---- chart --------------------------------------------------------------- */

.chart { width: 100%; display: block; overflow: visible; }
.chart .gridline { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-faint); font-family: var(--font-m); font-size: 10px; }
.chart .series { fill: none; stroke: var(--signal); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { fill: url(#fade); }
.chart .cursor { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--signal); }

/* ---- token page ---------------------------------------------------------- */

.token-head { display: flex; align-items: flex-end; gap: 26px; flex-wrap: wrap; margin-bottom: 34px; }
.token-head .price { font-family: var(--font-d); font-weight: 700; font-size: clamp(2.4rem, 5vw, 3.6rem); letter-spacing: -0.03em; }
.token-score { display: flex; align-items: center; gap: 20px; }
.score-dial { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.score-dial .val {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-d); font-weight: 700; font-size: 2.1rem; letter-spacing: -0.03em;
}
.score-dial .val small { font-family: var(--font-m); font-size: 0.58rem; letter-spacing: 0.16em; color: var(--ink-faint); font-weight: 400; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.kv > div { background: var(--bg-raise); padding: 14px 17px; }
.kv .k { font-family: var(--font-m); font-size: 0.63rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.kv .v { font-family: var(--font-m); font-size: 1.05rem; margin-top: 4px; }

/* ---- bars ---------------------------------------------------------------- */

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 132px 1fr 62px; align-items: center; gap: 12px; font-size: 0.82rem; }
.bar-track { height: 7px; background: var(--line-soft); position: relative; overflow: hidden; }
.bar-track i { position: absolute; inset: 0 auto 0 0; background: var(--signal); opacity: 0.85; }
.bar-row .bar-val { font-family: var(--font-m); text-align: right; color: var(--ink-dim); }

/* ---- footer -------------------------------------------------------------- */

footer {
  border-top: 1px solid var(--line);
  padding: 46px 0 60px;
  margin-top: 40px;
  color: var(--ink-faint);
  font-size: 0.82rem;
}
.foot-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
.foot-grid h4 { font-family: var(--font-m); font-size: 0.64rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); margin: 0 0 12px; }
.foot-grid a { display: block; padding: 3px 0; color: var(--ink-faint); }
.foot-grid a:hover { color: var(--signal); }
.foot-note { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; font-family: var(--font-m); font-size: 0.72rem; }

/* ---- reveal -------------------------------------------------------------- */
/* Elements start hidden and are revealed on scroll. Nothing depends on the
   reveal for legibility: .no-js and prefers-reduced-motion both show everything. */

.rv { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22,1,0.36,1); }
.rv.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  .ticker-track { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---- misc ---------------------------------------------------------------- */

.search-box { position: relative; max-width: 380px; width: 100%; }
.search-box input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-m);
  font-size: 0.85rem;
  padding: 10px 14px;
  outline: none;
  border-radius: 0;
}
.search-box input:focus { border-color: var(--signal-dk); }
.search-box input::placeholder { color: var(--ink-faint); }

.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-family: var(--font-m); font-size: 0.68rem; color: var(--ink-faint); }
.legend b { font-weight: 400; }

.note {
  border-left: 2px solid var(--signal-dk);
  padding: 13px 18px;
  background: var(--panel);
  font-size: 0.87rem;
  color: var(--ink-dim);
}
.note strong { color: var(--ink); font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
@media (max-width: 880px) {
  .two-col { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
  nav.top-nav { display: none; }
  .bar-row { grid-template-columns: 96px 1fr 56px; }
}

.skeleton {
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--panel-2) 50%, var(--line-soft) 75%);
  background-size: 200% 100%;
  animation: sk 1.4s infinite;
  color: transparent !important;
}
@keyframes sk { to { background-position: -200% 0; } }
