/* The Spot Gamma & Delta panel (showcase/chapters/greeks/_spot.html, greek-spot.js), the "spot" tab of
   the Greeks & Gamma Exposure chapter on /how-it-works/.
   The frame copies the real page, intrinio_options/templates/intrinio/spot_gamma_realtime.html:
   header strip (.sg-topbar :29-45, price badge :48-54), nav (.mr-nav :57-68), toolbar (.sg-toolbar
   :71-150), chart card (.dp-chart-card :153-167), chart colours (:553, :566, :587, :626-649, :661-662).
   The panel around it uses landing.css tokens. Everything is gks-* and scoped under .gks so it beats
   landing.css's element reset. JS state classes on .gks: is-ready, is-nodata, is-still, is-paused,
   is-cap, is-session, is-em-oi, is-em-vol, is-spot, is-hide-oi, is-hide-vol.
   Only transform and opacity animate in CSS; the bars are moved by greek-spot.js. Reduced motion
   (landing.css section 13, plus .is-still) and the paused state stop it all. */

.gks {
  --gks-oi: #00BFFF; --gks-vol: #9966CC; --gks-spot: #ffff00;
  --gks-p: #6759d1; --gks-p2: #a78bfa; --gks-p3: #c4b5fd; --gks-sky: #38bdf8; --gks-ice: #e0e7ff;
  --gks-bg: #15152c; --gks-line: rgba(103, 89, 209, .22); --gks-dim: #9a96bd;
  position: relative; min-width: 0;
}
html:not(.js) .gks-js, .gks-js, .gks.is-nodata .gks-js { display: none !important; }
.gks.is-ready:not(.is-nodata) .gks-card.gks-js { display: block !important; }
.gks.is-ready:not(.is-nodata) .gks-controls.gks-js { display: flex !important; }
.gks.is-ready:not(.is-nodata) .gks-poster { display: none; }

/* ---- panel head ---- */
.gks-head { max-width: 72ch; margin: 0 auto var(--lp-sp-5); text-align: center; }
.gks .gks-title { margin: 0; color: var(--lp-text); font: 700 var(--lp-fs-lg)/1.25 var(--lp-font-title); letter-spacing: -.01em; }
.gks .gks-lead { margin: var(--lp-sp-2) 0 0; color: var(--lp-muted); font-size: var(--lp-fs-base); line-height: 1.6; }

/* ---- the frame ---- */
.gks-frame {
  position: relative; min-width: 0; padding: 14px;
  border: 1px solid var(--lp-border-strong); border-radius: 16px; color: var(--gks-ice);
  background: radial-gradient(900px 420px at 92% -10%, rgba(103, 89, 209, .16), transparent 60%), var(--gks-bg);
  box-shadow: var(--lp-shadow), 0 0 80px color-mix(in srgb, var(--lp-primary) 10%, transparent);
  font: 400 13px/1.45 var(--lp-font);
}
.gks .gks-frame p { margin: 0; }

/* header strip (sg-topbar) */
.gks-top {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 16px; padding: 14px 18px 14px 22px; margin-bottom: 10px;
  border: 1px solid rgba(103, 89, 209, .3); border-radius: 14px; background: rgba(16, 16, 36, .97);
}
.gks-top::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, #a78bfa 0%, #6759d1 60%, #38bdf8 100%);
}
.gks-top-l { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; min-width: 0; }
.gks .gks-tkr { color: #fff; font: 900 28px/1 var(--lp-font); letter-spacing: -1px; }
.gks .gks-px {
  padding: 4px 14px; border-radius: 10px; border: 1px solid rgba(56, 189, 248, .35); background: rgba(56, 189, 248, .1);
  color: var(--gks-sky); font: 900 21px/1.2 var(--lp-font); letter-spacing: -.5px; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 14px rgba(56, 189, 248, .12);
}
.gks-meta { display: flex; flex-direction: column; gap: 3px; }
.gks .gks-eyebrow { color: var(--gks-p3); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.gks .gks-exp { color: var(--gks-dim); font-size: 12.5px; }
.gks-top-r { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.gks-clock {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, .3); background: rgba(16, 185, 129, .08); color: #34d399;
  font: 700 11px/1.4 var(--lp-font); letter-spacing: .4px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.gks-clock-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: #10b981; }
.gks.is-session .gks-clock-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; background: rgba(16, 185, 129, .45);
  animation: gks-pulse 2s ease-in-out infinite;
}

/* nav (mr-nav) */
.gks-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.gks-navbtn {
  padding: 7px 16px; border-radius: 10px; white-space: nowrap;
  border: 1px solid rgba(169, 158, 245, .2); color: #94a3b8; background: rgba(255, 255, 255, .03);
  font: 600 12.5px/1.3 var(--lp-font);
}
.gks-navbtn--on { color: var(--gks-ice); border-color: rgba(169, 158, 245, .5); background: linear-gradient(135deg, rgba(103, 89, 209, .25), rgba(169, 158, 245, .15)); }

/* toolbar (sg-toolbar) */
.gks-tools {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; padding: 10px 14px; margin-bottom: 12px;
  border: 1px solid var(--gks-line); border-radius: 12px; background: rgba(14, 14, 30, .95);
}
.gks-ctl { display: flex; flex-direction: column; gap: 5px; }
.gks-cl { color: #8a86ad; font: 700 10.5px/1 var(--lp-font); letter-spacing: 1px; text-transform: uppercase; }
.gks-ctl-row { display: inline-flex; gap: 6px; }
.gks-search, .gks-dd, .gks-go, .gks-ref {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid rgba(102, 126, 234, .3); background: rgba(102, 126, 234, .12); color: rgba(255, 255, 255, .9);
  font: 500 12.5px/1 var(--lp-font); white-space: nowrap;
}
.gks-search { min-width: 112px; color: rgba(255, 255, 255, .45); text-transform: uppercase; font-size: 11.5px; letter-spacing: .5px; }
.gks-go { background: rgba(102, 126, 234, .35); border-color: rgba(102, 126, 234, .6); color: #fff; font-weight: 600; }
.gks-dd svg { opacity: .6; }
.gks-sep { align-self: flex-end; width: 1px; height: 32px; margin: 0 4px; background: rgba(103, 89, 209, .25); }
.gks-ref { margin-left: auto; background: rgba(103, 89, 209, .35); border-color: var(--gks-p2); color: #fff; }

/* ---- chart card (dp-chart-card) ---- */
.gks-card {
  position: relative; overflow: hidden; min-width: 0; padding: 16px 14px 12px;
  border: 1px solid var(--gks-p); border-radius: 16px; background: linear-gradient(145deg, #1e1e38 0%, #252545 100%);
  box-shadow: 0 0 20px rgba(103, 89, 209, .15);
}
.gks-card + .gks-card { margin-top: 12px; }
.gks-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #6759d1, #c4b5fd, #6759d1); }
.gks-card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.gks .gks-card-t { color: var(--gks-p3); font: 600 11.5px/1.3 var(--lp-font); letter-spacing: 1.2px; text-transform: uppercase; }

/* Gamma / Delta switch (the real page shows both cards; here one card switches) */
.gks-seg { display: inline-flex; padding: 3px; border-radius: 10px; border: 1px solid rgba(169, 158, 245, .22); background: rgba(8, 8, 20, .5); }
.gks .gks-segbtn {
  min-height: 30px; padding: 0 14px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: #a6a3c8; font: 600 12px/1 var(--lp-font); letter-spacing: .3px;
}
.gks .gks-segbtn:hover { color: var(--gks-ice); }
.gks .gks-segbtn[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, rgba(103, 89, 209, .55), rgba(169, 158, 245, .3)); }

/* legend (Chart.js legend, :609-623): click hides a series, as on the real chart */
.gks-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin-bottom: 6px; }
.gks .gks-lg {
  display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 0 6px; border: 0; border-radius: 6px;
  background: none; color: rgba(224, 224, 255, .78); font: 500 12.5px/1 var(--lp-font); white-space: nowrap;
}
.gks button.gks-lg { cursor: pointer; }
.gks button.gks-lg:hover { color: #fff; }
.gks button.gks-lg[aria-pressed="false"] { color: rgba(224, 224, 255, .4); text-decoration: line-through; }
.gks-sw { display: inline-block; width: 26px; height: 10px; border-radius: 2px; }
.gks-sw--oi { background: var(--gks-oi); }
.gks-sw--vol { background: var(--gks-vol); }
.gks button.gks-lg[aria-pressed="false"] .gks-sw { opacity: .35; }

/* the chart: a fixed y axis beside a plot that scrolls sideways on phones */
.gks-chart { display: grid; grid-template-columns: 58px minmax(0, 1fr); }
.gks-yax { display: block; width: 58px; overflow: visible; }
.gks-scroll {
  min-width: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: #6759d1 rgba(103, 89, 209, .15);
}
.gks-stage { position: relative; outline: none; border-radius: 6px; }
.gks-stage:focus-visible { box-shadow: inset 0 0 0 2px var(--lp-accent); }
.gks-plot { display: block; overflow: visible; touch-action: pan-x pan-y; }
.gks-yax text, .gks-plot text, .gks-psvg text { font-family: var(--lp-font); }
.gks .gks-tk { fill: rgba(224, 224, 255, .6); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.gks .gks-tk.is-on { fill: #fff; font-weight: 700; }
.gks .gks-axt { fill: var(--gks-p3); font-size: 11px; }
.gks .gks-wm { fill: rgba(211, 211, 211, .07); font-size: 16px; }
.gks .gks-spotlbl {
  fill: var(--gks-spot); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  paint-order: stroke; stroke: rgba(8, 8, 20, .9); stroke-width: 3px; stroke-linejoin: round;
}
.gks-spotlbl-live { opacity: 0; transition: opacity .35s var(--lp-ease); }
.gks.is-spot .gks-spotlbl-live { opacity: 1; }
.gks-col { fill: rgba(196, 181, 253, .08); opacity: 0; }
.gks-col.is-on { opacity: 1; }
.gks-bars-oi, .gks-bars-vol { transition: opacity .3s var(--lp-ease); }
.gks.is-em-oi .gks-bars-vol, .gks.is-em-vol .gks-bars-oi { opacity: .22; }
.gks.is-hide-oi .gks-bars-oi, .gks.is-hide-vol .gks-bars-vol, .gks.is-hide-vol .gks-ghosts { opacity: 0; }
.gks-ghosts { opacity: 0; transition: opacity .3s var(--lp-ease); }
.gks.is-session .gks-ghosts { opacity: 1; }
.gks-ghost { fill: none; stroke: rgba(255, 255, 255, .7); stroke-width: 1; stroke-dasharray: 3 2; }

/* tooltip (Chart.js tooltip colours :626-628) */
.gks-tip {
  position: absolute; top: 0; left: 0; z-index: 2; min-width: 190px; padding: 9px 11px; pointer-events: none;
  border: 1px solid rgba(0, 216, 255, .4); border-radius: 8px; background: rgba(20, 20, 40, .94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45); color: rgba(224, 224, 255, .88); font: 500 12px/1.5 var(--lp-font);
  opacity: 0; transition: opacity .15s var(--lp-ease);
}
.gks-stage.is-tip .gks-tip { opacity: 1; }
.gks-tip b { display: block; margin-bottom: 3px; color: #00d8ff; font-weight: 700; }
.gks-tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.gks-tip-row[hidden] { display: none; }
.gks-tip-row i { flex: none; width: 9px; height: 9px; border-radius: 2px; }
.gks-tip-row em { margin-left: auto; padding-left: 14px; color: #fff; font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }

/* poster (no JS) */
.gks-pscroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #6759d1 rgba(103, 89, 209, .15); }
.gks-psvg { display: block; width: 100%; min-width: 600px; height: auto; }

/* caption pair + note */
.gks-caps {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 12px; padding: 10px 14px;
  border: 1px solid var(--gks-line); border-radius: 12px; background: rgba(14, 14, 30, .7);
  transition: opacity .35s var(--lp-ease), transform .35s var(--lp-ease);
}
.gks.is-ready:not(.is-nodata):not(.is-cap) .gks-caps { opacity: 0; transform: translateY(6px); }
.gks .gks-cap { display: inline-flex; align-items: center; gap: 8px; color: rgba(224, 224, 255, .85); font-size: 13px; transition: opacity .3s var(--lp-ease); }
.gks .gks-cap b { color: #fff; font-weight: 700; }
.gks .gks-cap .gks-sw { width: 14px; }
.gks.is-em-oi .gks-cap--vol, .gks.is-em-vol .gks-cap--oi { opacity: .4; }
.gks .gks-note { flex: 1 1 100%; color: var(--gks-dim); font-size: 12.5px; }

/* ---- below the frame: autoplay status, Replay, Pause ---- */
.gks-controls { flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--lp-sp-2); margin-top: var(--lp-sp-4); }
.gks-auto {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px 2px;
  border: 1px solid var(--lp-border); border-radius: var(--lp-r-pill); background: var(--lp-surface-2);
  color: var(--lp-muted); font-size: var(--lp-fs-xs); font-weight: 600; white-space: nowrap;
}
.gks-auto-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lp-green); }
.gks-auto.is-idle .gks-auto-dot, .gks-auto.is-stopped .gks-auto-dot { background: var(--lp-amber); }
.gks-auto-bar { position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px; overflow: hidden; border-radius: 2px; background: color-mix(in srgb, var(--lp-text) 10%, transparent); }
.gks-auto-bar i { display: block; height: 100%; background: var(--lp-primary); transform-origin: 0 50%; transform: scaleX(0); }
.gks-auto.is-idle .gks-auto-bar i, .gks-auto.is-stopped .gks-auto-bar i { background: var(--lp-amber); }
.gks-ico-play, .gks.is-paused .gks-ico-pause { display: none; }
.gks.is-paused .gks-ico-play { display: inline; }
.gks.is-ready.is-still .gks-controls.gks-js { display: none !important; }

/* ---- focus, press, motion ---- */
.gks :is(button, [tabindex]):focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
.gks .gks-stage:focus-visible { outline: none; }
.gks .is-press { transform: scale(.94); transition: transform .12s var(--lp-ease); }
@keyframes gks-pulse { 0%, 100% { opacity: .9; transform: scale(.6); } 50% { opacity: 0; transform: scale(1.5); } }
.gks.is-paused *, .gks.is-paused *::before, .gks.is-paused *::after { animation-play-state: paused !important; }
.gks.is-still *, .gks.is-still *::before, .gks.is-still *::after { animation: none !important; transition: none !important; }

/* ---- small screens ---- */
@media (max-width: 640px) {
  .gks-frame { padding: 10px; }
  .gks-top { padding: 12px 12px 12px 16px; }
  .gks .gks-tkr { font-size: 22px; }
  .gks .gks-px { font-size: 17px; padding: 3px 10px; }
  .gks-top-r { margin-left: 0; }
  .gks-tools { padding: 9px 10px; }
  .gks-sep { display: none; }
  .gks-search { min-width: 84px; }
  .gks-ref { margin-left: 0; }
  .gks-card { padding: 14px 8px 10px; }
  .gks-card-h { justify-content: center; text-align: center; }
  .gks-chart { grid-template-columns: 50px minmax(0, 1fr); }
  .gks-yax { width: 50px; }
}
