/* The Prices tab (rh-prices.js): a stock token's price on chain against the stock's own, as a professional chart.
   The token's buy-to-sell band and mid in Borro's orange, the stock's Chainlink feed as an ink step line, the hours the
   US market is shut shaded, prices on a right-hand axis, and the premium or discount in a strip underneath, all under
   one crosshair. Colours are tokens, so dark mode follows. */

/* The stock's name is the market picker: a quiet button that opens the searchable list (rh.css .asset-menu). */
.px-head { position: relative; }
.px-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.px-picker { display: inline-flex; align-items: center; gap: 12px; margin: -4px 0 -4px -6px; padding: 4px 10px 4px 6px; border: 1px solid transparent; border-radius: 12px; background: none; color: inherit; font: inherit; letter-spacing: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.px-picker:hover, .px-picker[aria-expanded="true"] { border-color: var(--line-2); background: var(--surface); }
.px-picker svg { color: var(--text-3); transition: transform .2s; }
.px-picker[aria-expanded="true"] svg { transform: rotate(180deg); }
.px-menu { right: auto; width: min(420px, calc(100vw - 32px)); top: calc(100% - 24px); }
.px-head.open .px-title > span { visibility: hidden; }
.px-menu .asset-items .r b.up { color: var(--up); }
.px-menu .asset-items .r b.down { color: var(--down); }
.px-title img { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); }
.px-title span { flex-basis: 100%; font: 500 15px/1.4 var(--ui); letter-spacing: 0; color: var(--text-3); }

/* The key over the chart. */
.px-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 16px; font-size: 13px; color: var(--text-2); }
.px-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.px-legend .px-asof { margin-left: auto; color: var(--text-3); }
.k { display: inline-block; flex: none; }
.k-band { width: 18px; height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--act) 22%, transparent); box-shadow: inset 0 0 0 1.5px var(--act); }
.k-feed { width: 18px; height: 2px; border-radius: 2px; background: var(--ink); }
.k-shut { width: 12px; height: 12px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 7%, transparent); box-shadow: inset 0 0 0 1px var(--line); }

/* The plot: the price chart, the premium strip and the time axis share one width; prices sit in a right gutter. */
.px-plot { --gut: 72px; position: relative; margin-top: 12px; cursor: crosshair; touch-action: pan-y; transition: opacity .2s; }
.px-plot.loading { opacity: .45; }
.px-skchart { height: clamp(200px, calc(100vh - 636px), 420px); border-radius: 16px; }
.px-main { position: relative; height: clamp(200px, calc(100vh - 636px), 420px); padding-right: var(--gut); }
.px-main svg, .px-gapbox svg { display: block; width: 100%; height: 100%; overflow: visible; }
.px-shut { fill: color-mix(in srgb, var(--ink) 4.5%, transparent); }
.px-grid { stroke: var(--line); stroke-width: 1; }
.px-band { fill: color-mix(in srgb, var(--act) 16%, transparent); }
.px-mid { fill: none; stroke: var(--act); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--act) 40%, transparent)); }
.px-feed { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; opacity: .85; }
.px-y { position: absolute; right: 0; width: calc(var(--gut) - 10px); transform: translateY(-50%); font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }

.px-gapbox { position: relative; height: 98px; margin-top: 12px; padding: 26px var(--gut) 0 0; border-top: 1px solid var(--line); }
.px-gaplabel { position: absolute; left: 0; top: 7px; font-size: 12px; color: var(--text-3); pointer-events: none; }
.px-gup { fill: color-mix(in srgb, var(--up) 30%, transparent); stroke: var(--up); stroke-width: 1; vector-effect: non-scaling-stroke; }
.px-gdown { fill: color-mix(in srgb, var(--down) 30%, transparent); stroke: var(--down); stroke-width: 1; vector-effect: non-scaling-stroke; }
.px-zero { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 4; }
.px-gy { position: absolute; right: 0; width: calc(var(--gut) - 10px); font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.px-gy-top { top: 24px; }
.px-gy-bot { bottom: -2px; }

.px-x { position: relative; height: 24px; margin-right: var(--gut); }
.px-x span { position: absolute; top: 6px; transform: translateX(-50%); font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* One crosshair through both charts, two dots on the lines, and a card with the numbers. */
.px-cross { position: absolute; top: 0; bottom: 24px; width: 1px; background: var(--text-3); opacity: 0; pointer-events: none; }
.px-dot { position: absolute; left: -5px; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; border: 2px solid var(--surface); }
.px-dmid { background: var(--act); box-shadow: 0 0 0 5px color-mix(in srgb, var(--act) 18%, transparent); }
.px-dfeed { background: var(--ink); }
.px-tip { position: absolute; top: 10px; z-index: 3; display: grid; gap: 6px; min-width: 220px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 18px 40px -20px rgba(13, 13, 15, .35); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .12s; }
.px-tip b { font-weight: 650; font-size: 13px; color: var(--text-2); }
.px-tip span { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.px-tip em { margin-left: auto; font-style: normal; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.px-tip .g { padding-top: 6px; border-top: 1px solid var(--line); }
.px-tip .g.up em { color: var(--up); }
.px-tip .g.down em { color: var(--down); }
.px-plot.scrubbing .px-cross, .px-plot.scrubbing .px-tip { opacity: 1; }
.px-empty { display: grid; place-items: center; height: clamp(200px, calc(100vh - 636px), 420px); color: var(--text-3); font-size: 14px; }

/* The quote size: a small segmented control. */
.px-size { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--sunk); }
.px-size button { height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: none; font: 600 13px var(--ui); color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums; transition: background .15s, color .15s; }
.px-size button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(13, 13, 15, .12); }

/* Every stock token. */
.px-h2 { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.px-h2 h2 { padding: 0; border: 0; }
.px-thead, .px-row { display: grid; grid-template-columns: minmax(170px, 1.5fr) repeat(3, minmax(0, 1fr)) 92px 80px; align-items: center; gap: 16px; }
.px-thead { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.px-thead span:nth-child(n+5) { text-align: right; }
.px-row { position: relative; width: 100%; padding: 12px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; transition: background .15s; }
.px-row:hover { background: var(--sunk); }
.px-row.on { background: color-mix(in srgb, var(--act) 7%, transparent); }
.px-row.on::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--act); }
.px-stock { display: flex; align-items: center; gap: 12px; min-width: 0; }
.px-stock img { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); }
.px-stock b { display: block; font-weight: 650; font-size: 15px; }
.px-stock small { display: block; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.px-num { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.px-num small { display: block; margin-top: 2px; font-weight: 500; font-size: 13px; color: var(--text-3); }
.px-num small.up { color: var(--up); }
.px-num small.down { color: var(--down); }
.px-pill { justify-self: end; min-width: 72px; padding: 5px 8px; border-radius: 8px; font-weight: 650; font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.px-pill.up { background: color-mix(in srgb, var(--up) 13%, transparent); color: var(--up); }
.px-pill.down { background: color-mix(in srgb, var(--down) 13%, transparent); color: var(--down); }
.px-spark { justify-self: end; width: 72px; height: 26px; }
.px-spark line { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 3; }
.px-spark path { fill: none; stroke-width: 1.5; }
.px-spark path.up { stroke: var(--up); }
.px-spark path.down { stroke: var(--down); }
.px-about a { color: var(--act-ink); font-weight: 600; text-decoration: none; }
.px-about a:hover { text-decoration: underline; }
.px-about + .px-about { padding-top: 0; }

/* The card: the gap at a size. */
.px-live { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--live); animation: px-pulse 2s infinite; vertical-align: 1px; }
.px-live.shut { background: var(--text-3); animation: none; }
@keyframes px-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.px-pick { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.px-pick img { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); }
.px-pick b { display: block; font-weight: 650; }
.px-pick small { display: block; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.px-card .orow b small { margin-left: 8px; font-weight: 600; font-size: 13px; color: var(--text-3); }
.px-card .orow b small.up { color: var(--up); }
.px-card .orow b small.down { color: var(--down); }
.px-read { margin-top: 14px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.px-acts { display: grid; gap: 10px; margin-top: 16px; }
.px-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.px-ghost:hover { filter: none; box-shadow: inset 0 0 0 1px var(--ink); }
.px-card .fine { margin-top: 14px; font-size: 13px; line-height: 1.5; color: var(--text-3); }

:root[data-theme="dark"] .px-tip { box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .8); }
:root[data-theme="dark"] .px-size button[aria-pressed="true"] { background: var(--line-2); }

@media (prefers-reduced-motion: reduce) {
  .px-live { animation: none; }
}
@media (max-width: 1240px) {
  .px-thead, .px-row { grid-template-columns: minmax(150px, 1.4fr) repeat(3, minmax(0, 1fr)) 84px; }
  .px-thead span:nth-child(6), .px-spark { display: none; }
}
@media (max-width: 640px) {
  .px-plot { --gut: 58px; }
  .px-main, .px-skchart, .px-empty { height: 240px; }
  .px-legend .px-asof { margin-left: 0; }
  .px-thead { display: none; }
  .px-row { grid-template-columns: minmax(0, 1fr) auto 84px; padding: 12px 4px; }
  .px-row > .px-num:nth-child(3), .px-row > .px-num:nth-child(4) { display: none; }
  .px-h2 { flex-wrap: wrap; }
  .px-tip { min-width: 190px; }
}
