/* tokens + token views (js/views/tokens.js, js/views/token.js) styles. Owner: tokens engineer.
   Base tokens and shared components: base.css. Scoped to .view-tokens / .view-token (set by app.js). */

/* =====================================================================================
   tape  #/tokens
   ===================================================================================== */
.view-tokens .tk-head { gap: 6px; }
.view-tokens .tk-tbl .tbl td { padding-top: 8px; padding-bottom: 8px; }
.tk-token { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
.tk-name { color: var(--text-2); font-size: 12px; max-width: 20ch; overflow: hidden; text-overflow: ellipsis; }
.tk-class {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3); text-transform: lowercase;
  border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; line-height: 15px;
}
.tk-spark { display: inline-flex; vertical-align: middle; }
.tk-acc { display: inline-flex; align-items: center; gap: 6px; }
.tk-acc-n { display: none; color: var(--text); }
.tk-state { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12px; white-space: nowrap; }
.tk-noprice { font-family: var(--font-mono); font-size: var(--fs-small); white-space: nowrap; }
.tk-sm { display: none; }

/* =====================================================================================
   token  #/token/<id>
   ===================================================================================== */
.tok-back { align-self: flex-start; font-size: 12px; color: var(--text-2); margin-bottom: -6px; }
.tok-back:hover { color: var(--white); }
.tok-top { gap: 6px; }
.tok-head .page-title .tok-sym { font-size: 18px; font-weight: 600; color: var(--white); }
.tok-last { display: inline-flex; align-items: baseline; gap: 6px; }
.tok-last-v { font-size: 15px; color: var(--white); }
.tok-last-d { font-size: 12px; }

/* chart + ladder share one column so their plot areas line up */
.tok-joined { display: flex; flex-direction: column; min-width: 0; }
.tok-joined > .pane + .pane { border-top: 0; }
.tok-joined > .pane + .pane .pane-head { padding-top: 10px; }

.tok-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tok-chart-box { position: relative; height: 360px; min-width: 0; }
.tok-chart { position: absolute; inset: 0; }
.tok-ohlc {
  position: absolute; left: 8px; top: 6px; z-index: 3; pointer-events: none;
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
  padding: 2px 6px; border-radius: 3px; background: rgba(19, 23, 34, .78);
  font-family: var(--font-mono); font-size: var(--fs-mono); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.tok-ohlc-sym { color: var(--text); font-weight: 500; }
.tok-ohlc-v { color: var(--text); }
.tok-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; }
.tok-keys-sep { width: 1px; height: 14px; background: var(--line); }
.tok-keys-note { font-size: var(--fs-small); }

/* ladder legend swatches (same marks as the rows) */
.tok-ladder-key .tok-key-sw { position: relative; display: inline-block; width: 10px; height: 12px; }
.tok-key-sw::after { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.tok-key-sw.is-dot::after { width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); }
.tok-key-sw.is-tick::after { width: 2px; height: 11px; border-radius: 1px; background: var(--text-2); }
.tok-key-sw.is-bear::after { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 7px solid var(--text-2); }

/* ---------- adoption ladder ---------- */
.ld { position: relative; min-width: 0; }
.ld-rows { position: relative; }
.ld-row { position: relative; height: 24px; border-radius: 2px; }
.ld-row:hover, .ld-row.is-selected { background: var(--chip); }
.ld-plot { position: absolute; left: 0; top: 0; bottom: 0; width: var(--plot-w, 100%); overflow: hidden; }
.ld-span {
  position: absolute; top: 50%; height: 1px; z-index: 0;
  background: var(--c, var(--grey)); opacity: .38;
}
.ld-span[hidden] { display: none; }
.ld-label {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  padding: 0 3px; line-height: 18px; border-radius: 2px; background: var(--bg);
  font-size: var(--fs-mono); color: var(--text);
}
.ld-row:hover .ld-label, .ld-row.is-selected .ld-label { background: var(--chip); }
.ld-label.is-edge { color: var(--text-3); }
.ld-label.is-over { z-index: 3; box-shadow: 0 0 0 1px var(--line); }
.ld-mark {
  position: absolute; top: 50%; z-index: 2; display: block; padding: 0; margin: 0;
  border: 0; background: transparent; transform: translate(-50%, -50%); cursor: pointer;
}
.ld-mark[hidden] { display: none; }
.ld-mark::before { content: ''; position: absolute; inset: -6px -4px; }   /* bigger hit area */
.ld-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--grey)); }
.ld-dot.is-hollow { background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--c, var(--grey)); }
.ld-row:hover .ld-dot.is-hollow, .ld-row.is-selected .ld-dot.is-hollow { background: var(--chip); }
.ld-dot.is-static { cursor: help; }
.ld-tick { width: 2px; height: 12px; border-radius: 1px; background: var(--c, var(--grey)); opacity: .85; }
.ld-bear {
  width: 0; height: 0; border-left: 4.5px solid transparent; border-right: 4.5px solid transparent;
  border-top: 7px solid var(--c, var(--grey));
}
.ld-mark:hover { filter: brightness(1.35); }
.ld-mark.is-selected { outline: 1px solid var(--white); outline-offset: 2px; z-index: 4; }
.ld-mark:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ld-count {
  position: absolute; top: 50%; transform: translateY(-50%); left: var(--plot-w, 100%); right: 0;
  padding-right: 4px; text-align: right; font-size: var(--fs-small); color: var(--text-3);
}
/* stacked rows (narrow plots): handle line on top, marks below */
.ld--stacked .ld-row { height: 36px; }
.ld--stacked .ld-label { top: 2px; transform: none; line-height: 14px; padding: 0; background: none; font-size: var(--fs-small); color: var(--text-2); }
.ld--stacked .ld-row:hover .ld-label, .ld--stacked .ld-row.is-selected .ld-label { background: none; color: var(--text); }
.ld--stacked .ld-mark, .ld--stacked .ld-span { top: 26px; }
.ld--stacked .ld-count { top: 26px; }
.ld-cross {
  position: absolute; top: 0; bottom: 0; width: 0; z-index: 3; pointer-events: none;
  border-left: 1px dashed var(--neutral); opacity: .55;
}
.ld-cross[hidden] { display: none; }
.ld--standalone .ld-cross { bottom: 26px; }
.ld-axis { position: relative; height: 22px; margin-top: 4px; border-top: 1px solid var(--line); width: var(--plot-w, 100%); }
.ld-axis[hidden] { display: none; }
.ld-axis-tick {
  position: absolute; top: 5px; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-2);
}
.ld-axis-tick::before { content: ''; position: absolute; left: 50%; top: -6px; height: 4px; border-left: 1px solid var(--line); }
.ld-row[hidden] { display: none; }
.ld-more { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 12px; padding-top: 10px; }
.ld-more-note { font-size: var(--fs-small); }
.ld-more:empty { display: none; }

/* receipt navigation (drawer) */
.tok-rnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 -2px; }
.tok-rnav .btn { height: 26px; padding: 0 8px; }
.tok-rnav .btn[disabled] { opacity: .35; cursor: default; }

/* =====================================================================================
   narrow screens
   ===================================================================================== */
@media (max-width: 720px) {
  .view-tokens .tk-opt, .view-tokens .tk-chips, .view-tokens .tk-state-label,
  .view-tokens .tk-name, .view-tokens .tk-class, .view-tokens .tk-lg { display: none; }
  .view-tokens .tk-acc-n, .view-tokens .tk-sm { display: inline; }
  .view-tokens .tk-pane > .pane-body { padding-left: 0; padding-right: 0; }
  .view-tokens .tbl th, .view-tokens .tbl td { padding-left: 7px; padding-right: 7px; }
  .view-tokens .tbl th:first-child, .view-tokens .tbl td:first-child { padding-left: 16px; }
  .view-tokens .tbl th:last-child, .view-tokens .tbl td:last-child { padding-right: 16px; }
  .view-tokens .tk-spark svg { width: 60px; height: 20px; }

  .tok-chart-box { height: 260px; }
  .tok-ohlc { font-size: var(--fs-small); gap: 2px 8px; }
  .view-token .pane-tools { margin-left: 0; width: 100%; }
  .tok-keys-note { display: none; }
}

/* other tokens: tokens.json index rows not on the tape */
.tk-more { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tk-more .chip { color: var(--text); }
.tk-more .chip--faint { color: var(--text-2); }
.tk-more-n { color: var(--text-3); font-size: 10.5px; }
