/* =========================================================================
   currency.ae — home-crypto.css
   The homepage Crypto market section — a compact, calm parallel to World Rates.
   Loaded only on the homepage. Uses the global tokens; the cool cyan accent is
   used sparingly (active tab + "All crypto" link + row hover) alongside the gold
   coin marks, matching the crypto section's restrained differentiation.
   ========================================================================= */

.mkt-section { padding: 1.75rem 0 0.5rem; }
.mkt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.mkt-head .section-title { margin: 0; }
.mkt-all { color: var(--up); text-decoration: none; font-size: 0.9rem; white-space: nowrap; }
.mkt-all:hover { text-decoration: underline; }
.mkt-asof { color: var(--text-dim); font-variant-numeric: tabular-nums; }

.mkt-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.6rem 0 0.75rem; }
.mkt-tab {
  font: inherit; font-size: 0.8rem; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.35rem 0.85rem; min-height: 2.1rem; cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.mkt-tab:hover { color: var(--text); border-color: rgba(52, 217, 166, 0.28); }
.mkt-tab[aria-pressed="true"] { color: var(--up); background: rgba(52, 217, 166, 0.12); border-color: rgba(52, 217, 166, 0.4); font-weight: 600; }

.mkt-list { display: flex; flex-direction: column; gap: 0.4rem; }
.mkt-row {
  display: grid; grid-template-columns: 1.9rem minmax(0, 1fr) auto auto 2rem;
  align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: inherit; text-decoration: none;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), transform 0.16s var(--ease);
}
.mkt-row:hover { border-color: rgba(52, 217, 166, 0.28); background: var(--surface-2); transform: translateY(-1px); }
.mkt-mark {
  width: 1.9rem; height: 1.9rem; flex: none; border-radius: 50%;
  background: var(--surface-3); display: grid; place-items: center;
  color: var(--gold); font-weight: 700; font-size: 0.82rem; object-fit: contain;
}
.mkt-mark img { width: 100%; height: 100%; border-radius: 50%; }
.mkt-ident { min-width: 0; }
.mkt-name { display: block; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-code { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; }
.mkt-price { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mkt-price small { display: block; color: var(--text-dim); font-size: 0.7rem; }
.mkt-chg { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 4.2em; }
.mkt-chg.up { color: var(--up); } .mkt-chg.down { color: var(--down); } .mkt-chg.flat { color: var(--text-dim); }
.mkt-star {
  appearance: none; border: 0; background: none; cursor: pointer;
  font-size: 1.02rem; line-height: 1; color: var(--text-dim);
  width: 2rem; height: 2rem; border-radius: 50%;
  transition: color 0.16s var(--ease), transform 0.16s var(--ease);
}
.mkt-star:hover { color: var(--gold); transform: scale(1.1); }
.mkt-star[aria-pressed="true"] { color: var(--gold); }

.mkt-foot { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; justify-content: space-between; margin: 0.7rem 0 0; font-size: 0.8rem; color: var(--text-dim); }
.mkt-foot a { color: var(--text-muted); }
.mkt-credit { color: var(--text-dim); }
.mkt-note { color: var(--text-dim); padding: 0.9rem; text-align: center; }

/* Loading skeleton (shimmer) — shown until the crypto snapshot arrives. */
.mkt-skel { pointer-events: none; }
.mkt-skelmark, .mkt-skelbar {
  display: inline-block; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: mktShimmer 1.3s linear infinite;
}
.mkt-skelbar--name { width: 96px; height: 12px; }
.mkt-skelbar--price { width: 62px; height: 12px; margin-left: auto; }
.mkt-skelbar--chg { width: 44px; height: 12px; margin-left: auto; }
@keyframes mktShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .mkt-skelmark, .mkt-skelbar { animation: none; } }

@media (max-width: 400px) {
  .mkt-row { grid-template-columns: 1.7rem minmax(0, 1fr) auto 1.7rem; gap: 0.45rem; padding: 0.55rem 0.6rem; }
  .mkt-mark { width: 1.7rem; height: 1.7rem; }
  .mkt-chg { display: none; } /* price + star stay; 24h is one tap away on the coin page */
}

@media (prefers-reduced-motion: reduce) {
  .mkt-row, .mkt-tab, .mkt-star { transition: none; }
  .mkt-row:hover { transform: none; }
}

/* ─────────────────────────────────────────────────────────────────────────
   Homepage converter — Currencies / Crypto mode toggle + panel switching.
   The Crypto panel is scoped `.crypto` in the markup so it reuses the crypto
   section's field styles (crypto.css) without touching the rest of the page.
   These rules cover the toggle (which sits OUTSIDE that scope) + the panels.
   ───────────────────────────────────────────────────────────────────────── */
.cvt-shell { min-width: 0; }
.cvt-panel[hidden] { display: none; }
/* A compact, secondary segmented control — slim height + tight margin so it reads
   as a control, not a hero element. Tap target stays ≥44px (min-height). */
.cvt-modes {
  display: inline-flex; border: 1px solid var(--border); border-radius: 999px;
  overflow: hidden; background: var(--surface); margin: 0 0 0.55rem;
}
.cvt-mode {
  font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
  background: none; border: 0; padding: 0.3rem 1rem; min-height: 44px;
  cursor: pointer; transition: color 0.16s var(--ease), background 0.16s var(--ease);
}
.cvt-mode + .cvt-mode { border-left: 1px solid var(--border); }
.cvt-mode:hover { color: var(--text); }
.cvt-mode[aria-selected="true"] { color: var(--up); background: rgba(52, 217, 166, 0.12); }
@media (prefers-reduced-motion: reduce) { .cvt-mode { transition: none; } }

/* ── Crypto mode: the selected coin's price trend fills the chart slot (mirrors
   where the fiat rate chart sits), now with timeframe toggles (24H/7D/1M/1Y/Max)
   + a hover tooltip (price · date · volume) via the shared crypto-chart module. ── */
/* The head wraps on narrow screens so the 5-range control never overflows; the
   coin code + % sit inline with the label. */
#crypto-history .history-card__head { align-items: center; flex-wrap: wrap; row-gap: 8px; }
#crypto-history .history-card__eyebrow { overflow: visible; flex: 1 1 auto; }
.ctrend-chg { margin-left: 6px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.92rem; white-space: nowrap; }
.ctrend-chg.up { color: var(--up); }
.ctrend-chg.down { color: var(--down); }
.ctrend-chg.flat { color: var(--text-dim); }
/* Compact range pill so all five fit the card head without horizontal scroll. */
#crypto-history .chart__ranges { flex: none; }
#crypto-history .chart__range { padding: 5px 10px; font-size: 0.75rem; min-height: 30px; }
/* Match the fiat chart's plot height so toggling Currencies↔Crypto never shifts
   the layout; position:relative anchors the crosshair/tooltip. */
.ctrend-plot { position: relative; height: 200px; margin-top: 10px; }
@media (min-width: 720px) { .ctrend-plot { height: 260px; } }
.ctrend-svg { width: 100%; height: 100%; display: block; }
.ctrend-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.ctrend-area { stroke: none; opacity: 0.1; }
.ctrend-empty { color: var(--text-dim); font-size: 0.85rem; padding: 1rem 0; text-align: center; }

/* Crypto Market-pulse (Feature D) — biggest 24h moves in the pulse slot, sharing
   the .pulse chrome. Compact rows (mark · name/code · 24h %) that link to profiles;
   overrides the fiat .pulse__list card grid with a calm vertical list. */
.cpulse__list { display: flex; flex-direction: column; gap: 6px; }
.cpulse-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; color: inherit; transition: border-color .15s ease, background .15s ease; }
.cpulse-row:hover { border-color: var(--border); background: var(--surface-2); }
.cpulse-mark { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden; font-size: 0.58rem; font-weight: 700; color: var(--text-dim); background: var(--bg); }
.cpulse-mark img { width: 24px; height: 24px; border-radius: 50%; }
.cpulse-ident { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.cpulse-ident b { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.cpulse-ident small { font-size: 0.72rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpulse-chg { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.cpulse-chg.up { color: var(--up); }
.cpulse-chg.down { color: var(--down); }
.cpulse-chg.flat { color: var(--text-dim); }
.cpulse__note { margin: 0.55rem 2px 0; font-size: 0.72rem; color: var(--text-dim); }
