/* Rootpad v3: the Coins page (docs/design-v3/DESIGN.md §5.2, mock panel 2). Loaded after css/site.css by coins.html
   only. Owner: C (COINS). Every rule is scoped under main.coins-page and uses the base tokens; nothing here moves (no
   transition, no keyframes, no motion block: the one motion block of site.css covers the rows' entrance, the bars and
   the grey loading blocks). The rows themselves are lib/coinrow.js (base styles in site.css §3.10); this file lays out
   the page around them, the Cards view (lib/coincard.js) and the empty states. Mobile first: phones, then 600px,
   900px (the table, the Cards / Table choice), 1080px and 1280px (more table columns). */

.coins-page {
  --tap: 44px;
  padding-top: var(--s6);
}

/* ------------------------------------------------------------ head: "Discover coins" and its lead */
.coins-page .dir-head {
  max-width: 760px;
  margin-bottom: var(--s5);
}
.coins-page .dir-head h1 {
  margin-bottom: var(--s2);
}
.coins-page .dir-head .lead {
  margin: 0;
  font-size: var(--fs-body);
}

/* ------------------------------------------------------------ the search, the window, the pills and the tools */
/* one column as wide as the page: the pill row that scrolls inside itself on phones never widens it */
.coins-page .dir-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s4);
}
.coins-page .dir-search .help {
  margin-top: var(--s2);
}
.coins-page .search-box input[type='search'] {
  -webkit-appearance: none;
  appearance: none;
}
.coins-page .search-box input[type='search']::-webkit-search-cancel-button {
  cursor: pointer;
}
/* "Last 24h ⌄" at the right of the search (the mock); on phones it drops under it, full width (site.css) */
.coins-page .window-wrap select {
  min-width: 168px;
}
.coins-page .window-wrap select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
@media (min-width: 600px) {
  .coins-page .search-row {
    flex-wrap: nowrap;
  }
  .coins-page .search-row > .search-box {
    max-width: 760px;
  }
  .coins-page .window-wrap {
    flex: 0 0 auto;
    margin-left: auto;
  }
}
.coins-page .dir-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3) var(--s4);
}
.coins-page .pill-row {
  flex: 1 1 auto;
  min-width: 0;
}
/* the chosen pill: solid green (the mock's "All"); the pills keep the tab semantics the page tests pin (aria-selected).
   One weight for every pill (§3.5): a bold chosen pill changed its width and shifted the row at each choice */
.coins-page .pill-row [role='tab'][aria-selected='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--glow-accent);
}
.coins-page .pill-row [role='tab'][aria-selected='false']:hover {
  border-color: var(--line-field);
  background: var(--card-2);
}
.coins-page .list-tools {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-left: auto;
}
/* Cards / Table: only where a table has room (900px and wider); below that the list cards are always used */
.coins-page .view-toggle {
  display: none;
}
@media (min-width: 900px) {
  .coins-page .view-toggle {
    display: inline-flex;
  }
}
/* Refresh while a read runs: it looks off and stays focusable (aria-disabled, never the disabled property) */
.coins-page #refresh[aria-disabled='true'] {
  color: var(--soft);
  border-style: dashed;
  cursor: progress;
}
/* phones: the pills in one row that scrolls inside itself (site.css), room for the focus ring */
@media (max-width: 599px) {
  .coins-page .pill-row { flex: 1 1 100%; padding: 4px 2px; }
  /* the scrolling row clips what leaves its box: the 24-px glow showed as a square halo, so only its 1-px ring here */
  .coins-page .pill-row [role='tab'][aria-selected='true'] {
    box-shadow: 0 0 0 1px var(--accent-line);
  }
}
/* phones and touch screens (§9.2, QA T-CHROME-4): the pills, Refresh, Cards / Table and USD / ETH (on phones too since
   D33) are whole 44-px tap targets; with a mouse the pills keep the mock's 34 px */
@media (max-width: 899px), (any-pointer: coarse) {
  .coins-page .pill-row [role='tab'],
  .coins-page .view-toggle button,
  .coins-page .unit-toggle button { min-height: var(--tap); }
  .coins-page #refresh { min-width: var(--tap); min-height: var(--tap); }
}

/* ------------------------------------------------------------ the order note, the live count, the activity line */
/* the same room above the list whether the count line shows or is for screen readers only (a card says it) */
.coins-page #sort-note {
  margin: var(--s4) 0 var(--s3);
}
.coins-page .dir-count {
  margin: 0 0 var(--s3);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}
.coins-page .activity-note {
  margin-bottom: var(--s3);
}
.coins-page .state-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
}
.coins-page .state-row .alert {
  flex: 1 1 280px;
  margin: 0;
}
.coins-page #list-state > * + * {
  margin-top: var(--s3);
}

/* ------------------------------------------------------------ the table (900px and wider; lib/coinrow.js) */
.coins-page .table-wrap {
  overflow-x: auto;
}
.coins-page .coins-table th:first-child,
.coins-page .coins-table td:first-child {
  padding-left: var(--s4);
}
.coins-page .coins-table th:last-child,
.coins-page .coins-table td:last-child {
  width: 1%;
  padding-right: var(--s4);
  text-align: right;
}
.coins-page .coins-table .coin-cell {
  min-width: 180px;
  max-width: 300px;
}
.coins-page .coins-table .coin-cell > div {
  min-width: 0;
}
/* a name is how people tell coins apart: up to two lines (a full 31-byte name fits), cut only beyond that */
.coins-page .coins-table .coin-name,
.coins-page li.coin-item .coin-link {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.coins-page .coins-table .row-warn {
  max-width: 36ch;
}
/* a value never splits from its unit ("0.0₅91 ETH", "0.02%"); the bars start at one edge whatever the percentage */
.coins-page #table-wrap .num,
.coins-page #coins .num,
.coins-page .coins-table td.n {
  white-space: nowrap;
}
.coins-page .coins-table .prog-cell .num {
  min-width: 5ch;
}
/* D33: the primary numbers (price and change, market cap, volume: .pri) in the text colour and a size up, the secondary
   ones (Root vault, holders, progress: .sec) quieter, a thin line between the two groups. Every number right-aligned in
   tabular figures (the base .n); each head two fixed lines: its name (with the sort chevron and the definition's "i"),
   then its unit, quieter, at the numbers' edge */
.coins-page .coins-table th { height: auto; padding-block: 10px; line-height: 1.25; vertical-align: top; }
.coins-page .coins-table .th-in { display: inline-grid; grid-template-columns: auto auto; align-items: center; column-gap: 2px; vertical-align: top; }
.coins-page .coins-table th.n .th-in { justify-items: end; }
.coins-page .coins-table .th-unit { grid-column: 1 / -1; color: var(--soft); font-weight: 400; }
.coins-page .coins-table th.pri { color: var(--text); }
.coins-page .coins-table td.pri .num { font-size: 15px; }
.coins-page .coins-table td.sec { color: var(--muted); font-size: 13px; }
.coins-page .coins-table td.sec .num { font-weight: 400; }
.coins-page .coins-table .pri + .sec { border-left: 1px solid var(--line); }
/* 900–1079px: eight columns since D33 (the market cap and the volume from 900px), so the cells are a little tighter, or
   the table (902px) is wider than its box from 900 to 950px and Buy / View hide behind its own scroll (Keystone) */
@media (max-width: 1079px) {
  .coins-page .coins-table th, .coins-page .coins-table td { padding-inline: 8px; }
  .coins-page .coins-table .coin-cell { min-width: 150px; }
}
/* a head's link to its definition below: a 24-px "i" (its words are for screen readers and in its title) */
.coins-page .th-def { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: -4px -5px -4px 0; vertical-align: top; border-radius: 50%; color: var(--soft); }
.coins-page .th-def::before { content: ''; width: 14px; height: 14px; background: currentColor; -webkit-mask: url('/img/ui/info.svg') center / 14px 14px no-repeat; mask: url('/img/ui/info.svg') center / 14px 14px no-repeat; }
.coins-page .th-def:hover { color: var(--accent-hover); }
/* a volume's thin bar: its share of the largest volume listed, grey (no colour of its own), from the numbers' edge */
.coins-page .vol-cell { display: inline-grid; justify-items: end; gap: 4px; }
.coins-page .vol-bar { display: block; width: 72px; height: 3px; overflow: hidden; border-radius: var(--r-pill); background: var(--line); }
.coins-page .vol-bar > span { display: block; min-width: 2px; height: 100%; margin-left: auto; border-radius: inherit; background: var(--soft); }

/* ------------------------------------------------------------ the list cards (below 900px; lib/coinrow.js) */
.coins-page li.coin-item.skeleton {
  grid-template-columns: 40px minmax(0, 1fr);
  min-height: 104px;
}
.coins-page li.coin-item.skeleton .sk-thumb {
  width: 40px;
  height: 40px;
}
/* D33: the phone card's three primary numbers: the price and its change at the top right, then the market cap and the
   volume in two fixed places (each its name and unit above it), the quieter line under them */
.coins-page li.coin-item .coin-price .num { font-size: 16px; }
.coins-page li.coin-item .coin-key { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s4); padding: var(--s2) 0; border-block: 1px solid var(--line); }
.coins-page .key-cell { display: grid; align-content: start; gap: 2px; min-width: 0; }
.coins-page .key-label { color: var(--muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em; }
.coins-page .key-v .num { font-size: 16px; }
.coins-page .key-v .vol-cell { justify-items: start; }
.coins-page .key-v .vol-bar > span { margin-left: 0; }
/* touch (a phone, or any screen that can be touched): each row's Buy / View is a whole tap target */
@media (max-width: 899px), (any-pointer: coarse) {
  .coins-page #coins .btn,
  .coins-page #table-wrap .btn {
    min-height: var(--tap);
  }
}

/* ------------------------------------------------------------ the Cards view (900px and wider; lib/coincard.js) */
.coins-page .coin-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 1080px) {
  .coins-page .coin-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.coins-page .coin-cards > li {
  display: flex;
  min-width: 0;
}
/* the whole card is one link to the coin page */
.coins-page a.coin-row {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-areas: 'img name' 'prog prog' 'raiz raiz';
  grid-template-rows: auto auto 1fr;
  gap: var(--s3);
  min-width: 0;
  padding: var(--s4) var(--s4) 0;
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
}
.coins-page a.coin-row:hover {
  border-color: var(--line-strong);
  color: var(--text);
}
.coins-page .coin-row .img {
  grid-area: img;
}
.coins-page .coin-row .img .thumb {
  width: 48px;
  height: 48px;
}
.coins-page .coin-row .name {
  grid-area: name;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
/* the rank chip keeps its room on the right */
.coins-page a.coin-row .name strong,
.coins-page a.coin-row .name .sym {
  padding-right: 52px;
}
/* the name: up to two lines (a full 31-byte name fits), cut only beyond that */
.coins-page .coin-row .name strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: var(--fs-h3);
  line-height: 1.3;
}
.coins-page .coin-row .name .sym {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.coins-page .coin-row .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.coins-page .coin-row .tags:empty {
  display: none;
}
.coins-page .coin-row .dormant-row {
  display: inline-flex;
}
/* the same-name-or-symbol warning: the whole sentence, never cut */
.coins-page .coin-row .warn {
  display: block;
  width: 100%;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}
.coins-page .coin-row .rank {
  position: absolute;
  top: var(--s4);
  right: var(--s4);
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--card-2);
  color: var(--muted);
  font: 700 13px / 1 var(--mono);
}
.coins-page .coin-row .prog {
  grid-area: prog;
  display: grid;
  gap: var(--s2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.coins-page .coin-row .raiz {
  grid-area: raiz;
  align-self: end;
  margin: var(--s1) calc(-1 * var(--s4)) 0;
  padding: var(--s3) var(--s4) var(--s4);
  border-top: 1px solid var(--line);
  background: var(--card-2);
  line-height: 1.4;
}
.coins-page .coin-row .raiz-label,
.coins-page .coin-row .raiz-sub {
  color: var(--muted);
  font-size: 13px;
}
.coins-page .coin-row .raiz .num {
  font-size: 20px;
}
/* a redemption amount is the vault's gold (DESIGN §2.1) */
.coins-page .coin-row .raiz-sub .num {
  color: var(--gold);
  font-size: 13px;
}
.coins-page .coin-cards > li.skeleton {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px 12px;
  min-height: 200px;
  padding: var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
}

/* ------------------------------------------------------------ empty states, and a coin this view leaves out */
.coins-page .card.empty {
  margin: 0;
}
.coins-page .card.empty .empty-title {
  max-width: 100%;
  overflow-wrap: anywhere;
}
/* the look-alike warnings keep the danger colour of every row (the base `.card.empty p` would make them grey) */
.coins-page .card.empty .row-warn {
  color: var(--danger-text);
  text-align: center;
}
.coins-page .coin-peek {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  max-width: 100%;
  min-height: var(--tap);
  padding: var(--s2) var(--s4) var(--s2) var(--s2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--card-2);
  color: var(--text);
  text-align: left;
  text-decoration: none;
}
.coins-page .coin-peek:hover {
  border-color: var(--line-field);
  color: var(--text);
}
.coins-page .peek-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.coins-page .peek-name strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.coins-page .peek-name .sym {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ under the list: Load more, read lines, definitions */
.coins-page .show-more {
  margin-top: var(--s4);
  text-align: center;
}
@media (max-width: 599px) {
  .coins-page #load-more {
    width: 100%;
  }
}
.coins-page #list-meta,
.coins-page #history-to, .coins-page #usd-note {
  margin: var(--s3) 0 0;
  text-align: center;
  text-wrap: balance;
}
.coins-page #list-meta:empty {
  margin: 0;
}
.coins-page .defs {
  margin: var(--s6) 0 0;
  padding-block: var(--s2);
}
.coins-page .defs[open] {
  padding-bottom: var(--pad);
}
.coins-page .defs dd {
  max-width: 80ch;
}
/* the Root vault's note: where the redemption value per token is, since the table and the phone list leave it out */
.coins-page .defs .def-note {
  display: block;
  margin-top: var(--s2);
  color: var(--text);
}
/* wide screens: each number next to its definition */
@media (min-width: 900px) {
  .coins-page .defs dl {
    display: grid;
    grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
    gap: 0 var(--s5);
  }
  .coins-page .defs dd {
    margin-top: var(--s3);
  }
}
/* the honest lines at the foot of the page */
.coins-page .dir-honest {
  max-width: 760px;
  margin: var(--s6) auto 0;
  padding: var(--s5) var(--s6);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
  text-align: center;
}
.coins-page .dir-honest p {
  margin: 0;
}
.coins-page .dir-honest p + p {
  margin-top: var(--s1);
}
.coins-page .dir-honest p:first-child {
  color: var(--text);
  font-weight: 700;
}
.coins-page .dir-honest .text-link {
  min-height: var(--tap);
}

/* ------------------------------------------------------------ forced colours: the chosen pill and the cards keep edges */
@media (forced-colors: active) {
  .coins-page .pill-row [role='tab'][aria-selected='true']:not(:focus-visible),
  .coins-page .view-toggle [aria-pressed='true']:not(:focus-visible) {
    outline: 2px solid CanvasText;
    outline-offset: -4px;
  }
  .coins-page a.coin-row,
  .coins-page .coin-peek,
  .coins-page .dir-honest {
    border: 1px solid CanvasText;
  }
  /* the definitions' "i" and the volume bars keep their paint (a background would be forced to Canvas) */
  .coins-page .th-def::before { forced-color-adjust: none; background-color: LinkText; }
  .coins-page .vol-bar { border: 1px solid CanvasText; }
  .coins-page .vol-bar > span { forced-color-adjust: none; background: CanvasText; }
}
