/* Hero "live desk": four small moving panels (frontend/templates/landing/partials/_hero_live.html).
   Colour, type size, spacing and radius come from the landing.css tokens only.
   Nothing here animates by itself: all motion is driven by live.js, which stops
   it under prefers-reduced-motion and from the pause button. */

.lp-live {
  container-type: inline-size;
  container-name: lp-live;
  display: grid;
  gap: var(--lp-sp-3);
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin-inline: auto;
}

/* A class-level display rule would otherwise beat the hidden attribute. */
.lp-live [hidden] { display: none !important; }

/* ---- header strip ---- */
.lp-live-bar {
  display: flex;
  align-items: center;
  gap: var(--lp-sp-3);
  min-height: 32px;
  min-width: 0;
}
.lp-live-symbol {
  font-family: var(--lp-font-title);
  font-size: var(--lp-fs-sm);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--lp-text);
}
.lp-live-mode,
.lp-live-tag {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.lp-live-tag { flex: 0 1 auto; }
/* Real (delayed or end of day) data: plain text, not the sample badge. */
.lp-live-real {
  font-size: var(--lp-fs-xs);
  font-weight: 500;
  color: var(--lp-muted);
}
.lp-live-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-r-pill);
  background: var(--lp-surface-2);
  color: var(--lp-text);
  cursor: pointer;
  transition: background-color var(--lp-dur) var(--lp-ease), border-color var(--lp-dur) var(--lp-ease);
}
.lp-live-toggle:hover { background: var(--lp-surface-3); border-color: var(--lp-border-strong); }
.lp-live-toggle:focus-visible {
  outline: 2px solid var(--lp-accent);
  outline-offset: 2px;
}
/* Inside the name's overflow clip, so the ring is drawn inward. */
.lp-live-link:focus-visible {
  outline: 2px solid var(--lp-accent);
  outline-offset: -2px;
}
.lp-live-ico--play { display: none; }
.lp-live-toggle[data-paused] .lp-live-ico--play { display: block; }
.lp-live-toggle[data-paused] .lp-live-ico--pause { display: none; }

/* ---- mosaic ---- */
.lp-live-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--lp-sp-3);
  min-width: 0;
}
.lp-live-panel {
  display: flex;
  flex-direction: column;
  gap: var(--lp-sp-2);
  min-width: 0;
  padding: var(--lp-sp-3);
  border-radius: var(--lp-r);
}
.lp-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--lp-sp-2);
  height: 22px;
  min-width: 0;
  /* One line, always: a long title takes the ellipsis and the data label keeps its
     place. A wrapping header changed the panel's height when the label changed,
     and the whole hero moved with it. */
  flex-wrap: nowrap;
}
.lp-live-head > .lp-live-tag { flex: none; }
/* Per-panel data label: quiet, the header strip carries the prominent one. It stays
   visible because each panel can be in a different data mode. */
.lp-live-tag.lp-sample {
  padding: 0;
  border: 0;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.lp-live-name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--lp-font);
  font-size: var(--lp-fs-sm);
  font-weight: 600;
  line-height: 1.3;
  color: var(--lp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lp-live-link {
  color: inherit;
  text-decoration: none;
  border-radius: var(--lp-r-sm);
}
.lp-live-link:hover { color: var(--lp-accent); text-decoration: underline; text-underline-offset: 3px; }
/* The plain name is the fallback when the tool has no Learn guide; a second
   matching guide link is never shown. */
.lp-live-link ~ .lp-live-plain,
.lp-live-link ~ .lp-live-link { display: none; }

/* Fixed aspect ratio: nothing shifts while data loads or charts redraw. */
.lp-live-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-r-sm);
  background: var(--lp-bg-2);
  contain: layout paint;
}
/* A panel stretched by a taller neighbour in its row grows its stage, never leaves a gap. */
.lp-live-panel > .lp-live-stage { flex: 1 0 auto; }
.lp-live-surface { touch-action: pan-y; }
.lp-live-canvas,
.lp-live-poster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.lp-live-stage.is-live .lp-live-poster { display: none; }
.lp-live-surface[data-scene-state="ready"] .lp-live-poster { display: none; }

/* Poster strokes (static sample drawings, also the no-JS state). */
.lp-live-poster path { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.lp-live-p-grid { stroke: var(--lp-border-strong); stroke-width: 1; }
.lp-live-p-up { stroke: var(--lp-green); }
.lp-live-p-down { stroke: var(--lp-red); }
.lp-live-p-price { stroke: var(--lp-text); stroke-width: 2; }
.lp-live-poster .lp-live-p-upfill { fill: var(--lp-green); stroke: none; }
.lp-live-poster .lp-live-p-downfill { fill: var(--lp-red); stroke: none; }
.lp-live-p-spot { stroke: var(--lp-text); stroke-width: 1; stroke-dasharray: 3 3; }
.lp-live-p-mesh { stroke: var(--lp-g-analytics); stroke-width: 1; opacity: .9; }
.lp-live-p-mesh2 { stroke: var(--lp-primary); stroke-width: 1; opacity: .7; }

/* ---- readout line under each chart ---- */
.lp-live-read {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0 var(--lp-sp-3);
  /* Fixed at two lines. The values change every frame while a chart animates; if
     this line could grow from one row to two, the panel, its neighbour and the hero
     would resize with it and everything below would jump up and down. */
  height: calc(2 * 1.5em);
  overflow: hidden;
  min-width: 0;
  margin: 0;
  font-size: var(--lp-fs-xs);
  line-height: 1.5;
  color: var(--lp-muted);
  font-variant-numeric: tabular-nums;
}
/* The line wraps between items, never inside one. */
.lp-live-k, .lp-live-at, .lp-live-g { white-space: nowrap; }
.lp-live-read b { font-weight: 600; color: var(--lp-text); }
.lp-live-k { display: inline-flex; align-items: center; gap: var(--lp-sp-1); }
.lp-live-k::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: var(--lp-r-pill);
  background: var(--lp-accent);
}
.lp-live-k--up::before { background: var(--lp-green); }
.lp-live-k--down::before { background: var(--lp-red); }
.lp-live-k--price::before { background: var(--lp-text); }
.lp-live-at { margin-left: auto; }
.lp-live-g abbr { text-decoration: none; color: var(--lp-muted); }

/* ---- flow tape (DOM rows, so the text is crisp and selectable) ---- */
.lp-live-tape {
  position: absolute;
  inset: 0 0 auto 0;
  margin: 0;
  padding: 0;
  list-style: none;
  will-change: transform;
}
.lp-live-row {
  display: grid;
  grid-template-columns: auto minmax(4ch, auto) auto minmax(9ch, 1fr) auto;
  align-items: center;
  gap: var(--lp-sp-2);
  height: 24px;
  padding: 0 var(--lp-sp-2);
  border-bottom: 1px solid var(--lp-border);
  font-size: var(--lp-fs-xs);
  line-height: 1;
  color: var(--lp-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.lp-live-tk { font-weight: 600; color: var(--lp-text); }
.lp-live-cp { font-weight: 700; }
.lp-live-cp[data-cp="CALL"] { color: var(--lp-green); }
.lp-live-cp[data-cp="PUT"] { color: var(--lp-red); }
.lp-live-st { overflow: hidden; text-overflow: ellipsis; }
.lp-live-pr { font-weight: 600; color: var(--lp-text); text-align: right; }

/* ---- greeks heatmap: strike x expiration grid of DOM cells ----
   Positive cells are green; each metric keeps its own negative colour, as on the
   member Greeks Heatmap (red GEX, pink DEX, orange VEX, purple CEX). Intensity is
   data-a (1 to 10, tenths of the panel's largest value of that sign). */
.lp-live-panel--hm { container: lp-live-hm / inline-size; }
.lp-live-hm-tabs {
  display: flex;
  gap: var(--lp-sp-1);
  min-width: 0;
}
.lp-live-hm-tab {
  min-width: 44px;
  min-height: 24px;
  padding: 0 var(--lp-sp-2);
  border: 1px solid var(--lp-border);
  border-radius: var(--lp-r-pill);
  background: var(--lp-surface-2);
  color: var(--lp-muted);
  font: inherit;
  font-size: var(--lp-fs-xs);
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--lp-dur) var(--lp-ease), color var(--lp-dur) var(--lp-ease), border-color var(--lp-dur) var(--lp-ease);
}
.lp-live-hm-tab abbr { text-decoration: none; }
.lp-live-hm-tab:hover { color: var(--lp-text); border-color: var(--lp-border-strong); }
.lp-live-hm-tab:focus-visible,
.lp-live-hm-view:focus-visible {
  outline: 2px solid var(--lp-accent);
  outline-offset: 2px;
}
.lp-live-hm-tab[aria-selected="true"] { color: var(--lp-bg); border-color: transparent; background: var(--lp-g-analytics); }
.lp-live-hm-tab[data-hm-tab="dex"][aria-selected="true"] { background: var(--lp-g-darkpool); }
.lp-live-hm-tab[data-hm-tab="vex"][aria-selected="true"] { background: var(--lp-amber); }
.lp-live-hm-tab[data-hm-tab="cex"][aria-selected="true"] { background: var(--lp-primary); }

.lp-live-hm-view {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--lp-sp-2);
  min-width: 0;
  min-height: 0;
  border-radius: var(--lp-r-sm);
}
/* The grid takes whatever height the row leaves (its content never sizes the
   panel), with a floor of 12 rows that stay readable. */
.lp-live-hmbox {
  flex: 1 1 0;
  aspect-ratio: auto;
  min-height: 156px;
  contain: size layout paint;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.lp-live-hm {
  --lp-live-hm-pos: var(--lp-green);
  --lp-live-hm-neg: var(--lp-red);
  --lp-live-hm-cols: 5;
  --lp-live-hm-rows: 11;
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: max-content repeat(var(--lp-live-hm-cols), minmax(0, 1fr));
  grid-template-rows: auto repeat(var(--lp-live-hm-rows), minmax(0, 1fr));
  gap: 1px;
  font-size: var(--lp-fs-xs);
  line-height: 1;
  color: var(--lp-muted);
  font-variant-numeric: tabular-nums;
}
.lp-live-hm[data-metric="dex"] { --lp-live-hm-neg: var(--lp-g-darkpool); }
.lp-live-hm[data-metric="vex"] { --lp-live-hm-neg: var(--lp-amber); }
.lp-live-hm[data-metric="cex"] { --lp-live-hm-neg: var(--lp-primary); }
.lp-live-hm-x {
  overflow: hidden;
  padding-bottom: var(--lp-sp-1);
  text-align: center;
  white-space: nowrap;
}
.lp-live-hm-short { display: none; }
.lp-live-hm-y {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding-right: var(--lp-sp-1);
  border-radius: 2px;
  white-space: nowrap;
}
.lp-live-hm-arrow { visibility: hidden; color: var(--lp-g-analytics); }
.lp-live-hm-y.is-spot { color: var(--lp-text); font-weight: 600; background: var(--lp-surface-3); }
.lp-live-hm-y.is-spot .lp-live-hm-arrow { visibility: visible; }
.lp-live-hm-c {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 2px;
  background: var(--lp-surface-2);
  transition: opacity .35s var(--lp-ease), transform .35s var(--lp-ease);
}
.lp-live-hm-c::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--lp-live-hm-pos);
  opacity: var(--lp-live-hm-a, 0);
  transition: opacity .3s var(--lp-ease), background-color .3s var(--lp-ease);
}
.lp-live-hm-c[data-s="n"]::before { background: var(--lp-live-hm-neg); }
/* The value in each cell, over its colour (as on the member Greeks Heatmap). */
.lp-live-hm-c { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lp-live-hm-v {
  position: relative;
  z-index: 1;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--lp-text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
@container lp-live-hm (max-width: 300px) { .lp-live-hm-v { font-size: 8px; letter-spacing: -.02em; } }
@container lp-live-hm (max-width: 230px) { .lp-live-hm-v { display: none; } }
.lp-live-hm-c[data-s="x"] { background: transparent; box-shadow: inset 0 0 0 1px var(--lp-border); }
.lp-live-hm-c.is-spot { box-shadow: inset 0 1px 0 var(--lp-g-analytics), inset 0 -1px 0 var(--lp-g-analytics); }
.lp-live-hm-c:hover,
.lp-live-hm-c.is-peak { z-index: 1; box-shadow: 0 0 0 1px var(--lp-text); }
.lp-live-hm-c[data-a="1"] { --lp-live-hm-a: .1; }
.lp-live-hm-c[data-a="2"] { --lp-live-hm-a: .2; }
.lp-live-hm-c[data-a="3"] { --lp-live-hm-a: .3; }
.lp-live-hm-c[data-a="4"] { --lp-live-hm-a: .4; }
.lp-live-hm-c[data-a="5"] { --lp-live-hm-a: .5; }
.lp-live-hm-c[data-a="6"] { --lp-live-hm-a: .6; }
.lp-live-hm-c[data-a="7"] { --lp-live-hm-a: .7; }
.lp-live-hm-c[data-a="8"] { --lp-live-hm-a: .8; }
.lp-live-hm-c[data-a="9"] { --lp-live-hm-a: .9; }
.lp-live-hm-c[data-a="10"] { --lp-live-hm-a: 1; }
/* First view: cells fill in a diagonal sweep (live.js adds .is-in cell by cell). */
.lp-live-hm.is-sweeping .lp-live-hm-c:not(.is-in) { opacity: 0; transform: scale(.6); }
/* The scan bar: one row tall, moved row by row by live.js. */
.lp-live-hm-scan {
  position: absolute;
  inset: 0;
  grid-column: 2 / -1;
  grid-row: 2 / 3;
  z-index: 2;
  border-radius: 2px;
  background: var(--lp-surface-3);
  box-shadow: 0 0 0 1px var(--lp-border-strong);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--lp-ease), transform .12s linear;
}
.lp-live-hm-scan.is-on { opacity: 1; }
.lp-live-hm-read {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@container lp-live-hm (max-width: 299.98px) {
  .lp-live-hm-long { display: none; }
  .lp-live-hm-short { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .lp-live-hm-c,
  .lp-live-hm-c::before,
  .lp-live-hm-scan,
  .lp-live-hm-tab { transition: none; }
}

/* ---- narrow column: one row that snaps sideways inside the mosaic (the page itself never scrolls sideways) ---- */
@container lp-live (max-width: 470px) {
  .lp-live-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(232px, 80%);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--lp-border-strong) transparent;
    padding-bottom: var(--lp-sp-2);
  }
  .lp-live-panel { scroll-snap-align: start; }
}

/* Narrow panels: drop the print time so strike and expiry stay readable. */
@container lp-live (max-width: 560px) {
  .lp-live-t { display: none; }
  .lp-live-row { grid-template-columns: minmax(4ch, auto) auto minmax(9ch, 1fr) auto; }
}
