/* Silo markets rows — slate-style presentation.
   Rows are re-rendered by js/silo-markets.js into .sm-* markup; this file owns
   all of their styling. Kept separate so design passes on responsive.css can't
   clobber it (responsive.css table rules are scoped to :not(.sm-table)). */

/* the card fills the viewport and scrolls internally; clip (not hidden) so
   stray programmatic scrolls can't shove the shell out of view */
body { overflow: clip; }

/* Failsafe for the html.silo-loading first-paint gate: if the script that
   releases it (silo-carousel.js) fails or never runs, reveal the page anyway
   after 1.2s rather than leaving a white screen. */
html.silo-loading body { animation: silo-gate-failsafe 0s 1.2s forwards; }
@keyframes silo-gate-failsafe { to { visibility: visible; } }

.sm-table {
  --sm-card: #fcfcfb;
  --sm-line: #ececea;
  --sm-head-line: #e5e5e3;
  --sm-ink: #17181a;
  --sm-num: #1c2024;
  --sm-mut: #878e97;
  --sm-faint: #9aa1a9;
  --sm-up: #12996a;
  --sm-down: #d64f4f;
  --sm-hover: #f5f5f3;
  --sm-accent: #e0447c;
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.sm-table .sm-c {
  padding: 13px 12px;
  border-bottom: 1px solid var(--sm-line);
  vertical-align: middle;
  transition: background-color 0.12s ease;
}
.sm-table thead .sm-c {
  padding: 12px 12px 8px;
  border-bottom: 0;
  /* the card scrolls internally (silo-ui fill pass), so pin the header */
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--sm-card);
}
/* rows dissolve under the pinned header instead of clipping on a hairline */
.sm-table thead .sm-c::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 26px;
  background: linear-gradient(to bottom, var(--sm-card) 0%, rgba(252, 252, 251, 0.85) 38%, rgba(252, 252, 251, 0) 100%);
  pointer-events: none;
  /* scroll-driven: invisible at rest so row #1 stays clean, fades in over
     the first 48px of scroll (browsers without scroll timelines keep the
     always-on fade) */
  animation: sm-head-fade linear both;
  animation-timeline: scroll(nearest);
  animation-range: 0px 48px;
  opacity: 0;
}
@keyframes sm-head-fade { to { opacity: 1; } }

/* matching fade at the card's bottom edge; slips away at the end of scroll */
div:has(> table)::after {
  content: "";
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: block;
  height: 32px;
  margin-top: -32px;
  background: linear-gradient(to bottom, rgba(252, 252, 251, 0) 0%, rgba(252, 252, 251, 0.85) 62%, #fcfcfb 100%);
  pointer-events: none;
  animation: sm-foot-fade linear both;
  animation-timeline: scroll(self);
  animation-range: calc(100% - 48px) 100%;
}
@keyframes sm-foot-fade { to { opacity: 0; } }
.sm-table tbody tr:last-child .sm-c { border-bottom: 0; }
.sm-table th { text-align: left; font-weight: 500; }
.sm-table thead .sm-c-rank { text-align: center; }

/* ===== the card holds only the column header + rows ===== */
/* title / tabs / toolbar float above the card on the page background */
div[class*="lg:gap-2.5"][class*="justify-between"] {
  position: relative;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 2px 0 12px !important;
}
div:has(> table) { border-radius: 20px 20px 0 0 !important; }

/* one 36px pill family for tabs + filter controls, flush with the card edges:
   the title tracks the card's left edge, the last filter button its right */
@media (min-width: 1024px) {
  div[class*="lg:bg-transparent"] > div { padding-inline: 0 !important; }
}
@media (min-width: 1200px) {
  div[class*="lg:gap-2.5"][class*="justify-between"] {
    min-height: 70px;
    align-items: flex-end !important;
  }
}
div[role="button"][class*="min-w-[266px]"],
button[class*="h-9"][class*="rounded-md"] {
  color: #4b5563 !important;
}
div[role="button"][class*="min-w-[266px]"]:hover,
button[class*="h-9"][class*="rounded-md"]:hover,
button[aria-label="Columns"]:hover > div {
  background: #e4e4e2 !important;
  color: #1f2530 !important;
}

/* thinner rows (overrides the 15px pass in responsive.css) */
.sm-table td.sm-c { padding-top: 9px !important; padding-bottom: 9px !important; }

/* column plan */
.sm-c-rank { width: 58px; padding-left: 20px; }
.sm-c-trend { width: 136px; }
.sm-c-price { width: 140px; }
.sm-c-tvl, .sm-c-fees, .sm-c-vol { width: 116px; }
.sm-c-go { width: 48px; padding-right: 18px; }
.sm-num { text-align: right; }

/* header */
.sm-th {
  font-size: 11px;
  font-weight: 500;
  color: var(--sm-faint);
  letter-spacing: 0.015em;
  white-space: nowrap;
}
.sm-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease;
}
.sm-sort:hover { color: #4b5563; }
.sm-sort-glyph { width: 10px; height: 12px; opacity: 0.55; }
.sm-sort-glyph path { transition: opacity 0.15s ease; }
th[aria-sort="descending"] .sm-sg-up,
th[aria-sort="ascending"] .sm-sg-dn { opacity: 0; }
th[aria-sort="descending"] .sm-sort,
th[aria-sort="ascending"] .sm-sort { color: var(--sm-accent); }
th[aria-sort="descending"] .sm-sort-glyph,
th[aria-sort="ascending"] .sm-sort-glyph { opacity: 0.9; }

/* rows */
.sm-row { cursor: pointer; }
.sm-row:hover .sm-c { background: var(--sm-hover); }

/* rank + favorite */
.sm-rank-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
/* ranks come from a CSS counter over visible rows, so they stay sequential
   through sorting and through rows hidden by the token/advanced filters */
.sm-table tbody { counter-reset: smrank; }
.sm-table tbody tr:not([hidden]) { counter-increment: smrank; }
.sm-rank-n::before { content: "#" counter(smrank); }
.sm-rank-n {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--sm-faint);
  font-variant-numeric: tabular-nums;
}
.sm-fav {
  display: flex;
  padding: 2px;
  border: 0;
  background: none;
  cursor: pointer;
  color: #ccd2d9;
  transition: color 0.15s ease, transform 0.15s ease;
}
.sm-fav svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
.sm-fav:hover { color: var(--sm-faint); transform: scale(1.12); }
.sm-fav[aria-pressed="true"] { color: #ff80ab; }
.sm-fav[aria-pressed="true"] svg { fill: currentColor; }

/* pool cell */
.sm-pool-flex {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.sm-icons { display: flex; flex: none; }
.sm-coin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cbg, #ebedef);
  color: var(--cfg, #5c6570);
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--sm-card, #fcfcfb);
}
.sm-coin + .sm-coin,
.sm-icons img + img { margin-left: -9px; }
.sm-icons img {
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  padding: 2px;
  background: #f1f2f5;
  box-shadow: 0 0 0 2px var(--sm-card, #fcfcfb);
}
.sm-row:hover .sm-coin,
.sm-row:hover .sm-icons img { box-shadow: 0 0 0 2px var(--sm-hover); }
.sm-pool-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sm-pair {
  display: flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--sm-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-robinhood-name-badge {
  width: 13px;
  height: 13px;
  margin-left: 5px;
  flex: none;
  border-radius: 4px;
  background: #caff00;
  object-fit: cover;
}
.sm-sep {
  margin: 0 3px;
  color: #c5cbd2;
  font-weight: 500;
}
.sm-meta {
  font-size: 11px;
  color: var(--sm-mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-meta i {
  font-style: normal;
  color: #cbd0d6;
  margin: 0 5px;
}

/* sparkline */
.sm-spark {
  display: block;
  width: 96px;
  height: 30px;
}

/* numbers */
.sm-v {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--sm-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.sm-v small {
  margin-left: 3px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--sm-mut);
}
.sm-d {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sm-up { color: var(--sm-up); }
.sm-down { color: var(--sm-down); }
.sm-flat { color: var(--sm-faint); }
.sm-tri { width: 7px; height: 7px; fill: currentColor; flex: none; }
.sm-down .sm-tri { transform: rotate(180deg); }

/* chevron */
.sm-c-go { text-align: right; }
.sm-go-icon {
  width: 15px;
  height: 15px;
  color: #c9cfd6;
  transition: color 0.15s ease, transform 0.18s ease;
}
.sm-row:hover .sm-go-icon {
  color: var(--sm-mut);
  transform: translateX(2px);
}

/* search palette reuses the monogram avatars */
.search-pal-logo .sm-coin {
  width: 24px;
  height: 24px;
  font-size: 10px;
  box-shadow: 0 0 0 2px var(--paper, #faf9f7);
}
.search-pal-logo .sm-coin + .sm-coin { margin-left: -8px; }

/* Design contract: the rank and the per-metric deltas are part of the markets
   data (see the Meteora reference) and stay visible — rendered quiet, slate
   style. This intentionally overrides the "Slate-clean pass" suppressions in
   responsive.css; keep any future cleanup passes off .sm-* markup. */
.sm-c-rank,
table :is(th, td).sm-c-rank { display: table-cell !important; }
.sm-d { display: inline-flex !important; }

/* responsive column drops */
@media (max-width: 1120px) {
  .sm-c-trend { display: none; }
}
@media (max-width: 940px) {
  .sm-c-fees { display: none; }
}
@media (max-width: 720px) {
  .sm-c-rank, .sm-c-vol, .sm-c-go,
  table :is(th, td).sm-c-rank { display: none !important; }
  .sm-c-pool { padding-left: 16px; }
  .sm-c-tvl { padding-right: 16px; }
  .sm-table .sm-c { padding-top: 11px; padding-bottom: 11px; }
  .sm-coin, .sm-icons img { width: 24px; height: 24px; font-size: 10px; }
  .sm-coin + .sm-coin, .sm-icons img + img { margin-left: -8px; }
  .sm-pool-flex { gap: 10px; }
}

/* numeric column headers right-align with the values beneath them */
.sm-table thead th.sm-num { text-align: right; }
.sm-table thead th.sm-num .sm-sort { justify-content: flex-end; }

/* the pair stands alone — no project / asset-type line beneath it */
.sm-table .sm-c-pool .sm-meta { display: none; }

/* the window a flow column is totalled over — Fees and Volume are the active
   timeframe's share of the day, so the header says which (silo-timeframe.js) */
.sm-th-tf {
  margin-right: 5px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  color: inherit;
  opacity: 0.75;
}
